Skip to content

Commit 287273a

Browse files
Dan Carpenterjwrdegoede
authored andcommitted
platform/mellanox: mlxreg-lc: fix error code in mlxreg_lc_create_static_devices()
This code should be using PTR_ERR() instead of IS_ERR(). And because it's using the wrong "dev->client" pointer, the IS_ERR() check will be false, meaning the function returns success. Fixes: 62f9529 ("platform/mellanox: mlxreg-lc: Add initial support for Nvidia line card devices") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Vadim Pasternak <[email protected]> Link: https://lore.kernel.org/r/20211110074346.GB5176@kili Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent fa55b7d commit 287273a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

drivers/platform/mellanox/mlxreg-lc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ mlxreg_lc_create_static_devices(struct mlxreg_lc *mlxreg_lc, struct mlxreg_hotpl
413413
int size)
414414
{
415415
struct mlxreg_hotplug_device *dev = devs;
416-
int i;
416+
int i, ret;
417417

418418
/* Create static I2C device feeding by auxiliary or main power. */
419419
for (i = 0; i < size; i++, dev++) {
@@ -423,6 +423,7 @@ mlxreg_lc_create_static_devices(struct mlxreg_lc *mlxreg_lc, struct mlxreg_hotpl
423423
dev->brdinfo->type, dev->nr, dev->brdinfo->addr);
424424

425425
dev->adapter = NULL;
426+
ret = PTR_ERR(dev->client);
426427
goto fail_create_static_devices;
427428
}
428429
}
@@ -435,7 +436,7 @@ mlxreg_lc_create_static_devices(struct mlxreg_lc *mlxreg_lc, struct mlxreg_hotpl
435436
i2c_unregister_device(dev->client);
436437
dev->client = NULL;
437438
}
438-
return IS_ERR(dev->client);
439+
return ret;
439440
}
440441

441442
static void

0 commit comments

Comments
 (0)