Skip to content

Commit

Permalink
platform/mellanox: mlxreg-lc: fix error code in mlxreg_lc_create_stat…
Browse files Browse the repository at this point in the history
…ic_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 <dan.carpenter@oracle.com>
Acked-by: Vadim Pasternak <vadimp@nvidia.com>
Link: https://lore.kernel.org/r/20211110074346.GB5176@kili
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Dan Carpenter authored and jwrdegoede committed Nov 16, 2021
1 parent fa55b7d commit 287273a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/platform/mellanox/mlxreg-lc.c
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,7 @@ mlxreg_lc_create_static_devices(struct mlxreg_lc *mlxreg_lc, struct mlxreg_hotpl
int size)
{
struct mlxreg_hotplug_device *dev = devs;
int i;
int i, ret;

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

dev->adapter = NULL;
ret = PTR_ERR(dev->client);
goto fail_create_static_devices;
}
}
Expand All @@ -435,7 +436,7 @@ mlxreg_lc_create_static_devices(struct mlxreg_lc *mlxreg_lc, struct mlxreg_hotpl
i2c_unregister_device(dev->client);
dev->client = NULL;
}
return IS_ERR(dev->client);
return ret;
}

static void
Expand Down

0 comments on commit 287273a

Please sign in to comment.