diff mbox series

video: fbdev: pm2fb: fix missing pci_disable_device()

Message ID 20221112095510.3639570-1-yangyingliang@huawei.com
State New
Headers show
Series video: fbdev: pm2fb: fix missing pci_disable_device() | expand

Commit Message

Yang Yingliang Nov. 12, 2022, 9:55 a.m. UTC
Add missing pci_disable_device() in error path of probe() and remove() path.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
 drivers/video/fbdev/pm2fb.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Helge Deller Nov. 14, 2022, 7:26 a.m. UTC | #1
On 11/12/22 10:55, Yang Yingliang wrote:
> Add missing pci_disable_device() in error path of probe() and remove() path.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>


applied.
Thanks!
Helge

> ---
>   drivers/video/fbdev/pm2fb.c | 9 +++++++--
>   1 file changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/video/fbdev/pm2fb.c b/drivers/video/fbdev/pm2fb.c
> index 7da715d31a93..7a8609c40ae9 100644
> --- a/drivers/video/fbdev/pm2fb.c
> +++ b/drivers/video/fbdev/pm2fb.c
> @@ -1533,8 +1533,10 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   	}
>
>   	info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev);
> -	if (!info)
> -		return -ENOMEM;
> +	if (!info) {
> +		err = -ENOMEM;
> +		goto err_exit_disable;
> +	}
>   	default_par = info->par;
>
>   	switch (pdev->device) {
> @@ -1715,6 +1717,8 @@ static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   	release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len);
>    err_exit_neither:
>   	framebuffer_release(info);
> + err_exit_disable:
> +	pci_disable_device(pdev);
>   	return retval;
>   }
>
> @@ -1739,6 +1743,7 @@ static void pm2fb_remove(struct pci_dev *pdev)
>   	fb_dealloc_cmap(&info->cmap);
>   	kfree(info->pixmap.addr);
>   	framebuffer_release(info);
> +	pci_disable_device(pdev);
>   }
>
>   static const struct pci_device_id pm2fb_id_table[] = {
diff mbox series

Patch

diff --git a/drivers/video/fbdev/pm2fb.c b/drivers/video/fbdev/pm2fb.c
index 7da715d31a93..7a8609c40ae9 100644
--- a/drivers/video/fbdev/pm2fb.c
+++ b/drivers/video/fbdev/pm2fb.c
@@ -1533,8 +1533,10 @@  static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	}
 
 	info = framebuffer_alloc(sizeof(struct pm2fb_par), &pdev->dev);
-	if (!info)
-		return -ENOMEM;
+	if (!info) {
+		err = -ENOMEM;
+		goto err_exit_disable;
+	}
 	default_par = info->par;
 
 	switch (pdev->device) {
@@ -1715,6 +1717,8 @@  static int pm2fb_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 	release_mem_region(pm2fb_fix.mmio_start, pm2fb_fix.mmio_len);
  err_exit_neither:
 	framebuffer_release(info);
+ err_exit_disable:
+	pci_disable_device(pdev);
 	return retval;
 }
 
@@ -1739,6 +1743,7 @@  static void pm2fb_remove(struct pci_dev *pdev)
 	fb_dealloc_cmap(&info->cmap);
 	kfree(info->pixmap.addr);
 	framebuffer_release(info);
+	pci_disable_device(pdev);
 }
 
 static const struct pci_device_id pm2fb_id_table[] = {