Re: [PATCH v3 2/3] platform/x86: int3472: Fix uninitialised variable warning

Ricardo Ribalda Delgado <[email protected]>
Newsgroups org.kernel.vger.linux-acpi,org.kernel.vger.linux-media,org.kernel.vger.platform-driver-x86
Message-ID <CAPybu_1J4z2Z0Xv1PyHZa2U+PFsTWPVyifJr2p8DgkQRTJm6YQ@mail.gmail.com>
nits:

It would be nice to have the error message that it is fixed in the
commit message (also for 1/3)

Would you consider adding a Fixes? This patch fixes a compilation
error (with the right kernel config)

On Tue, Aug 25, 2026 at 10:36 PM Sakari Ailus
<[email protected]> wrote:
>
> Fix a smatch warning about uninitialised err_msg variable, by printing the
> error where it is handled.
>
Reviewed-by: Ricardo Ribalda <[email protected]>
> Signed-off-by: Sakari Ailus <[email protected]>
> ---
>  drivers/platform/x86/intel/int3472/discrete.c | 25 +++++++++++--------
>  1 file changed, 14 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/platform/x86/intel/int3472/discrete.c b/drivers/platform/x86/intel/int3472/discrete.c
> index 6c729fcfce5d..9cd4f78875ab 100644
> --- a/drivers/platform/x86/intel/int3472/discrete.c
> +++ b/drivers/platform/x86/intel/int3472/discrete.c
> @@ -329,7 +329,6 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>         unsigned long gpio_flags;
>         union acpi_object *obj;
>         struct gpio_desc *gpio;
> -       const char *err_msg;
>         const char *con_id;
>         int ret;
>
> @@ -375,7 +374,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>         case INT3472_GPIO_TYPE_HOTPLUG_DETECT:
>                 ret = skl_int3472_map_gpio_to_sensor(int3472, agpio, con_id, gpio_flags);
>                 if (ret)
> -                       err_msg = "Failed to map GPIO pin to sensor\n";
> +                       dev_err_probe(int3472->dev, ret,
> +                                     "Failed to map GPIO pin to sensor\n");
>
>                 break;
>         case INT3472_GPIO_TYPE_CLK_ENABLE:
> @@ -387,7 +387,7 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>                 gpio = skl_int3472_gpiod_get_from_temp_lookup(int3472, agpio, con_id, gpio_flags);
>                 if (IS_ERR(gpio)) {
>                         ret = PTR_ERR(gpio);
> -                       err_msg = "Failed to get GPIO\n";
> +                       dev_err_probe(int3472->dev, ret, "Failed to get GPIO\n");
>                         break;
>                 }
>
> @@ -395,14 +395,16 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>                 case INT3472_GPIO_TYPE_CLK_ENABLE:
>                         ret = skl_int3472_register_gpio_clock(int3472, gpio);
>                         if (ret)
> -                               err_msg = "Failed to register clock\n";
> +                               dev_err_probe(int3472->dev, ret,
> +                                             "Failed to register clock\n");
>
>                         break;
>                 case INT3472_GPIO_TYPE_PRIVACY_LED:
>                 case INT3472_GPIO_TYPE_STROBE:
>                         ret = skl_int3472_register_led(int3472, gpio, con_id);
>                         if (ret)
> -                               err_msg = "Failed to register LED\n";
> +                               dev_err_probe(int3472->dev, ret,
> +                                             "Failed to register LED\n");
>
>                         break;
>                 case INT3472_GPIO_TYPE_POWER_ENABLE:
> @@ -413,7 +415,8 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>                         ret = skl_int3472_register_regulator(int3472, gpio, enable_time_us,
>                                                              con_id, second_sensor);
>                         if (ret)
> -                               err_msg = "Failed to register regulator\n";
> +                               dev_err_probe(int3472->dev, ret,
> +                                             "Failed to register regulator\n");
>
>                         break;
>                 default: /* Never reached */
> @@ -436,11 +439,11 @@ static int skl_int3472_handle_gpio_resources(struct acpi_resource *ares,
>         int3472->ngpios++;
>         ACPI_FREE(obj);
>
> -       if (ret < 0)
> -               return dev_err_probe(int3472->dev, ret, err_msg);
> -
> -       /* Tell acpi_dev_get_resources() to not make a copy of the resource */
> -       return 1;
> +       /*
> +        * Either return an error or tell acpi_dev_get_resources() to not make a
> +        * copy of the resource.
> +        */
> +       return ret < 0 ? ret : 1;
>  }
>
>  int int3472_discrete_parse_crs(struct int3472_discrete_device *int3472)
> --
> 2.47.3
>
>


-- 
Ricardo Ribalda
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.