]> git.baikalelectronics.ru Git - kernel.git/commit
platform/mellanox: mlxreg-hotplug: Fix uninitialized variable
authorGeert Uytterhoeven <geert@linux-m68k.org>
Wed, 7 Feb 2018 09:12:04 +0000 (10:12 +0100)
committerDarren Hart (VMware) <dvhart@infradead.org>
Fri, 9 Feb 2018 01:43:37 +0000 (17:43 -0800)
commitd1d350c24a3a32aea9cb767c0fd6aa47fb4993ec
tree3ff5c94d1d2b283f87fcbfb83ffa545464c96472
parenteedc3563ba1cb94fab1ca54a531783617a967ac1
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: 627642557ce55de8 ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface")
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Signed-off-by: Darren Hart (VMware) <dvhart@infradead.org>
drivers/platform/mellanox/mlxreg-hotplug.c