Commit 79e90ca0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Hans de Goede

platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices()

This should return PTR_ERR() instead of IS_ERR().  Also "dev->client"
has been set to NULL by this point so it returns 0/success so preserve
the error code earlier.

Fixes: 662f2482 ("platform/mellanox: Add support for new SN2201 system")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarMichael Shych <michaelsh@nvidia.com>
Link: https://lore.kernel.org/r/YqmUGwmPK7cPolk/@kiliReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent d63eae67
...@@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201, ...@@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
int size) int size)
{ {
struct mlxreg_hotplug_device *dev = devs; struct mlxreg_hotplug_device *dev = devs;
int ret;
int i; int i;
/* Create I2C static devices. */ /* Create I2C static devices. */
...@@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201, ...@@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
dev->nr, dev->brdinfo->addr); dev->nr, dev->brdinfo->addr);
dev->adapter = NULL; dev->adapter = NULL;
ret = PTR_ERR(dev->client);
goto fail_create_static_devices; goto fail_create_static_devices;
} }
} }
...@@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201, ...@@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
dev->client = NULL; dev->client = NULL;
dev->adapter = NULL; dev->adapter = NULL;
} }
return IS_ERR(dev->client); return ret;
} }
static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201, static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment