* [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices()
@ 2022-06-15 8:11 Dan Carpenter
2022-06-15 8:23 ` Michael Shych
2022-06-22 10:23 ` Hans de Goede
0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2022-06-15 8:11 UTC (permalink / raw)
To: Hans de Goede, Michael Shych
Cc: Mark Gross, Vadim Pasternak, platform-driver-x86, kernel-janitors
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: 662f24826f95 ("platform/mellanox: Add support for new SN2201 system")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/platform/mellanox/nvsw-sn2201.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c
index 0bcdc7c75007..217e22e81c1a 100644
--- a/drivers/platform/mellanox/nvsw-sn2201.c
+++ b/drivers/platform/mellanox/nvsw-sn2201.c
@@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
int size)
{
struct mlxreg_hotplug_device *dev = devs;
+ int ret;
int i;
/* Create I2C static devices. */
@@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
dev->nr, dev->brdinfo->addr);
dev->adapter = NULL;
+ ret = PTR_ERR(dev->client);
goto fail_create_static_devices;
}
}
@@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
dev->client = NULL;
dev->adapter = NULL;
}
- return IS_ERR(dev->client);
+ return ret;
}
static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
--
2.35.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices()
2022-06-15 8:11 [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices() Dan Carpenter
@ 2022-06-15 8:23 ` Michael Shych
2022-06-22 10:23 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Michael Shych @ 2022-06-15 8:23 UTC (permalink / raw)
To: Dan Carpenter, Hans de Goede
Cc: Mark Gross, Vadim Pasternak, platform-driver-x86, kernel-janitors
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@oracle.com>
> Sent: Wednesday, June 15, 2022 11:11 AM
> To: Hans de Goede <hdegoede@redhat.com>; Michael Shych
> <michaelsh@nvidia.com>
> Cc: Mark Gross <markgross@kernel.org>; Vadim Pasternak
> <vadimp@nvidia.com>; platform-driver-x86@vger.kernel.org; kernel-
> janitors@vger.kernel.org
> Subject: [PATCH] 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: 662f24826f95 ("platform/mellanox: Add support for new SN2201
> system")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Michael Shych <michaelsh@nvidia.com>
> ---
> drivers/platform/mellanox/nvsw-sn2201.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/mellanox/nvsw-sn2201.c
> b/drivers/platform/mellanox/nvsw-sn2201.c
> index 0bcdc7c75007..217e22e81c1a 100644
> --- a/drivers/platform/mellanox/nvsw-sn2201.c
> +++ b/drivers/platform/mellanox/nvsw-sn2201.c
> @@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct
> nvsw_sn2201 *nvsw_sn2201,
> int size)
> {
> struct mlxreg_hotplug_device *dev = devs;
> + int ret;
> int i;
>
> /* Create I2C static devices. */
> @@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct
> nvsw_sn2201 *nvsw_sn2201,
> dev->nr, dev->brdinfo->addr);
>
> dev->adapter = NULL;
> + ret = PTR_ERR(dev->client);
> goto fail_create_static_devices;
> }
> }
> @@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct
> nvsw_sn2201 *nvsw_sn2201,
> dev->client = NULL;
> dev->adapter = NULL;
> }
> - return IS_ERR(dev->client);
> + return ret;
> }
>
> static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201
> *nvsw_sn2201,
> --
> 2.35.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices()
2022-06-15 8:11 [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices() Dan Carpenter
2022-06-15 8:23 ` Michael Shych
@ 2022-06-22 10:23 ` Hans de Goede
1 sibling, 0 replies; 3+ messages in thread
From: Hans de Goede @ 2022-06-22 10:23 UTC (permalink / raw)
To: Dan Carpenter, Michael Shych
Cc: Mark Gross, Vadim Pasternak, platform-driver-x86, kernel-janitors
Hi,
On 6/15/22 10:11, Dan Carpenter wrote:
> 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: 662f24826f95 ("platform/mellanox: Add support for new SN2201 system")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thank you for your patch, I've applied this patch to my review-hans
branch:
https://git.kernel.org/pub/scm/linux/kernel/git/pdx86/platform-drivers-x86.git/log/?h=review-hans
Note it will show up in my review-hans branch once I've pushed my
local branch there, which might take a while.
Once I've run some tests on this branch the patches there will be
added to the platform-drivers-x86/for-next branch and eventually
will be included in the pdx86 pull-request to Linus for the next
merge-window.
Regards,
Hans
> ---
> drivers/platform/mellanox/nvsw-sn2201.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/platform/mellanox/nvsw-sn2201.c b/drivers/platform/mellanox/nvsw-sn2201.c
> index 0bcdc7c75007..217e22e81c1a 100644
> --- a/drivers/platform/mellanox/nvsw-sn2201.c
> +++ b/drivers/platform/mellanox/nvsw-sn2201.c
> @@ -890,6 +890,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
> int size)
> {
> struct mlxreg_hotplug_device *dev = devs;
> + int ret;
> int i;
>
> /* Create I2C static devices. */
> @@ -901,6 +902,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
> dev->nr, dev->brdinfo->addr);
>
> dev->adapter = NULL;
> + ret = PTR_ERR(dev->client);
> goto fail_create_static_devices;
> }
> }
> @@ -914,7 +916,7 @@ nvsw_sn2201_create_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
> dev->client = NULL;
> dev->adapter = NULL;
> }
> - return IS_ERR(dev->client);
> + return ret;
> }
>
> static void nvsw_sn2201_destroy_static_devices(struct nvsw_sn2201 *nvsw_sn2201,
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-06-22 10:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-15 8:11 [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices() Dan Carpenter
2022-06-15 8:23 ` Michael Shych
2022-06-22 10:23 ` Hans de Goede
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.