diff mbox series

media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr()

Message ID 20211012082150.GA31086@kili (mailing list archive)
State New, archived
Headers show
Series media: atomisp: fix uninitialized bug in gmin_get_pmic_id_and_addr() | expand

Commit Message

Dan Carpenter Oct. 12, 2021, 8:21 a.m. UTC
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(-)

Comments

Kieran Bingham Oct. 12, 2021, 12:15 p.m. UTC | #1
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
>
diff mbox series

Patch

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)