[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BN9PR12MB538173B0C85C0080732A0721AF939@BN9PR12MB5381.namprd12.prod.outlook.com>
Date: Wed, 10 Nov 2021 10:27:18 +0000
From: Vadim Pasternak <vadimp@...dia.com>
To: Dan Carpenter <dan.carpenter@...cle.com>,
Hans de Goede <hdegoede@...hat.com>
CC: Mark Gross <markgross@...nel.org>,
Michael Shych <michaelsh@...dia.com>,
"platform-driver-x86@...r.kernel.org"
<platform-driver-x86@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kernel-janitors@...r.kernel.org" <kernel-janitors@...r.kernel.org>
Subject: RE: [PATCH] platform/mellanox: mlxreg-lc: fix error code in
mlxreg_lc_create_static_devices()
> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@...cle.com>
> Sent: Wednesday, November 10, 2021 9:44 AM
> To: Hans de Goede <hdegoede@...hat.com>; Vadim Pasternak
> <vadimp@...dia.com>
> Cc: Mark Gross <markgross@...nel.org>; Michael Shych
> <michaelsh@...dia.com>; platform-driver-x86@...r.kernel.org; linux-
> kernel@...r.kernel.org; kernel-janitors@...r.kernel.org
> Subject: [PATCH] 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: 62f9529b8d5c ("platform/mellanox: mlxreg-lc: Add initial support for
> Nvidia line card devices")
> Signed-off-by: Dan Carpenter <dan.carpenter@...cle.com>
Acked-by: Vadim Pasternak <vadimp@...dia.com>
> ---
> drivers/platform/mellanox/mlxreg-lc.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/platform/mellanox/mlxreg-lc.c
> b/drivers/platform/mellanox/mlxreg-lc.c
> index 0b7f58feb701..c897a2f15840 100644
> --- a/drivers/platform/mellanox/mlxreg-lc.c
> +++ b/drivers/platform/mellanox/mlxreg-lc.c
> @@ -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++) {
> @@ -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;
> }
> }
> @@ -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
> --
> 2.20.1
Powered by blists - more mailing lists