diff mbox series

video: fbdev: vermilion: decrease reference count in error path

Message ID 20221114085654.179249-1-wangxiongfeng2@huawei.com
State New
Headers show
Series video: fbdev: vermilion: decrease reference count in error path | expand

Commit Message

Xiongfeng Wang Nov. 14, 2022, 8:56 a.m. UTC
pci_get_device() will increase the reference count for the returned
pci_dev. For the error path, we need to use pci_dev_put() to decrease
the reference count.

Fixes: dbe7e429fedb ("vmlfb: framebuffer driver for Intel Vermilion Range")
Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>
---
 drivers/video/fbdev/vermilion/vermilion.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Helge Deller Nov. 14, 2022, 6:48 p.m. UTC | #1
On 11/14/22 09:56, Xiongfeng Wang wrote:
> pci_get_device() will increase the reference count for the returned
> pci_dev. For the error path, we need to use pci_dev_put() to decrease
> the reference count.
>
> Fixes: dbe7e429fedb ("vmlfb: framebuffer driver for Intel Vermilion Range")
> Signed-off-by: Xiongfeng Wang <wangxiongfeng2@huawei.com>

applied.

Thanks!
Helge

> ---
>   drivers/video/fbdev/vermilion/vermilion.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c
> index 82b36dbb5b1a..33051e3a2561 100644
> --- a/drivers/video/fbdev/vermilion/vermilion.c
> +++ b/drivers/video/fbdev/vermilion/vermilion.c
> @@ -278,8 +278,10 @@ static int vmlfb_get_gpu(struct vml_par *par)
>
>   	mutex_unlock(&vml_mutex);
>
> -	if (pci_enable_device(par->gpu) < 0)
> +	if (pci_enable_device(par->gpu) < 0) {
> +		pci_dev_put(par->gpu);
>   		return -ENODEV;
> +	}
>
>   	return 0;
>   }
diff mbox series

Patch

diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c
index 82b36dbb5b1a..33051e3a2561 100644
--- a/drivers/video/fbdev/vermilion/vermilion.c
+++ b/drivers/video/fbdev/vermilion/vermilion.c
@@ -278,8 +278,10 @@  static int vmlfb_get_gpu(struct vml_par *par)
 
 	mutex_unlock(&vml_mutex);
 
-	if (pci_enable_device(par->gpu) < 0)
+	if (pci_enable_device(par->gpu) < 0) {
+		pci_dev_put(par->gpu);
 		return -ENODEV;
+	}
 
 	return 0;
 }