Skip to content

Commit b81e830

Browse files
geertudvhart
authored andcommitted
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: c6acad6 ("platform/mellanox: mlxreg-hotplug: Modify to use a regmap interface") Signed-off-by: Geert Uytterhoeven <[email protected]> Acked-by: Vadim Pasternak <[email protected]> Signed-off-by: Darren Hart (VMware) <[email protected]>
1 parent 9a7c551 commit b81e830

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/platform/mellanox/mlxreg-hotplug.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ mlxreg_hotplug_health_work_helper(struct mlxreg_hotplug_priv_data *priv,
300300
{
301301
struct mlxreg_core_data *data = item->data;
302302
u32 regval;
303-
int i, ret;
303+
int i, ret = 0;
304304

305305
for (i = 0; i < item->count; i++, data++) {
306306
/* Mask event. */

0 commit comments

Comments
 (0)