[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <AM4PR05MB3330B66B4D7077DA6EAB882EA2FC0@AM4PR05MB3330.eurprd05.prod.outlook.com>
Date: Wed, 7 Feb 2018 09:39:22 +0000
From: Vadim Pasternak <vadimp@...lanox.com>
To: Geert Uytterhoeven <geert@...ux-m68k.org>,
Andy Shevchenko <andy@...radead.org>,
Darren Hart <dvhart@...radead.org>
CC: Arnd Bergmann <arnd@...db.de>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: RE: [PATCH] platform/mellanox: mlxreg-hotplug: Fix uninitialized
variable
> -----Original Message-----
> From: Geert Uytterhoeven [mailto:geert@...ux-m68k.org]
> Sent: Wednesday, February 07, 2018 11:12 AM
> To: Andy Shevchenko <andy@...radead.org>; Darren Hart
> <dvhart@...radead.org>; Vadim Pasternak <vadimp@...lanox.com>
> Cc: Arnd Bergmann <arnd@...db.de>; platform-driver-x86@...r.kernel.org;
> linux-kernel@...r.kernel.org; Geert Uytterhoeven <geert@...ux-m68k.org>
> Subject: [PATCH] platform/mellanox: mlxreg-hotplug: Fix uninitialized variable
>
> With gcc-4.1.2:
>
> drivers/platform/mellanox/mlxreg-hotplug.c: In function
> ‘mlxreg_hotplug_health_work_helper’:
> drivers/platform/mellanox/mlxreg-hotplug.c:347: warning: ‘ret’ is used
> uninitialized in this function
>
> Indeed, if mlxreg_core_item.count is zero, ret is used uninitialized.
>
> While this is unlikely to happen (it is set to ARRAY_SIZE(...) in x86 board files),
> this is done in another source file, so fix this by preinitializing ret to zero.
>
> Fixes: c6acad68eb2dbffd ("platform/mellanox: mlxreg-hotplug: Modify to use a
> regmap interface")
> Signed-off-by: Geert Uytterhoeven <geert@...ux-m68k.org>
Acked-by: Vadim Pasternak <vadimp@...lanox.com>
> ---
> drivers/platform/mellanox/mlxreg-hotplug.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-hotplug.c
> b/drivers/platform/mellanox/mlxreg-hotplug.c
> index 0dfa1ca0d05b0217..313cf8ad77bf68ce 100644
> --- a/drivers/platform/mellanox/mlxreg-hotplug.c
> +++ b/drivers/platform/mellanox/mlxreg-hotplug.c
> @@ -300,7 +300,7 @@ mlxreg_hotplug_health_work_helper(struct
> mlxreg_hotplug_priv_data *priv, {
> struct mlxreg_core_data *data = item->data;
> u32 regval;
> - int i, ret;
> + int i, ret = 0;
>
> for (i = 0; i < item->count; i++, data++) {
> /* Mask event. */
> --
> 2.7.4
Powered by blists - more mailing lists