Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79e90ca

Browse files
Dan Carpenterjwrdegoede
authored andcommitted
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: 662f248 ("platform/mellanox: Add support for new SN2201 system") Signed-off-by: Dan Carpenter <[email protected]> Acked-by: Michael Shych <[email protected]> Link: https://lore.kernel.org/r/YqmUGwmPK7cPolk/@kili Reviewed-by: Hans de Goede <[email protected]> Signed-off-by: Hans de Goede <[email protected]>
1 parent d63eae6 commit 79e90ca

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/platform/mellanox/nvsw-sn2201.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
890890
int size)
891891
{
892892
struct mlxreg_hotplug_device *dev = devs;
893+
int ret;
893894
int i;
894895

895896
/* Create I2C static devices. */
@@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
901902
dev->nr, dev->brdinfo->addr);
902903

903904
dev->adapter = NULL;
905+
ret = PTR_ERR(dev->client);
904906
goto fail_create_static_devices;
905907
}
906908
}
@@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
914916
dev->client = NULL;
915917
dev->adapter = NULL;
916918
}
917-
return IS_ERR(dev->client);
919+
return ret;
918920
}
919921

920922
static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201,

0 commit comments

Comments
 (0)