linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr()
@ 2021-10-12  8:21 Dan Carpenter
  2021-10-12 12:15 ` Kieran Bingham
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2021-10-12  8:21 UTC (permalink / raw)
  To: Mauro Carvalho Chehab, Andy Shevchenko
  Cc: Sakari Ailus, Greg Kroah-Hartman, Aniket Bhattacharyea,
	linux-media, linux-staging, kernel-janitors

The "power" pointer is not initialized on the else path and that would
lead to an Oops.

Fixes: c30f4cb2d4c7 ("media: atomisp: Refactor PMIC detection to a separate function")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
index d8c9e31314b2..62dc06e22476 100644
--- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
+++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
@@ -481,7 +481,7 @@ static int atomisp_get_acpi_power(struct device *dev)
 
 static u8 gmin_get_pmic_id_and_addr(struct device *dev)
 {
-	struct i2c_client *power;
+	struct i2c_client *power = NULL;
 	static u8 pmic_i2c_addr;
 
 	if (pmic_id)
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr()
  2021-10-12  8:21 [PATCH] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() Dan Carpenter
@ 2021-10-12 12:15 ` Kieran Bingham
  0 siblings, 0 replies; 2+ messages in thread
From: Kieran Bingham @ 2021-10-12 12:15 UTC (permalink / raw)
  To: Andy Shevchenko, Dan Carpenter, Mauro Carvalho Chehab
  Cc: Sakari Ailus, Greg Kroah-Hartman, Aniket Bhattacharyea,
	linux-media, linux-staging, kernel-janitors

Quoting Dan Carpenter (2021-10-12 09:21:50)
> The "power" pointer is not initialized on the else path and that would
> lead to an Oops.
> 

Yes, that looks like a good catch.

Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com>

> Fixes: c30f4cb2d4c7 ("media: atomisp: Refactor PMIC detection to a separate function")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> index d8c9e31314b2..62dc06e22476 100644
> --- a/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> +++ b/drivers/staging/media/atomisp/pci/atomisp_gmin_platform.c
> @@ -481,7 +481,7 @@ static int atomisp_get_acpi_power(struct device *dev)
>  
>  static u8 gmin_get_pmic_id_and_addr(struct device *dev)
>  {
> -       struct i2c_client *power;
> +       struct i2c_client *power = NULL;
>         static u8 pmic_i2c_addr;
>  
>         if (pmic_id)
> -- 
> 2.20.1
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-10-12 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-12  8:21 [PATCH] media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() Dan Carpenter
2021-10-12 12:15 ` Kieran Bingham

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).