RE: [PATCH] platform/mellanox: nvsw-sn2201: fix error code in nvsw_sn2201_create_static_devices()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




> -----Original Message-----
> From: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> Sent: Wednesday, June 15, 2022 11:11 AM
> To: Hans de Goede <hdegoede@xxxxxxxxxx>; Michael Shych
> <michaelsh@xxxxxxxxxx>
> Cc: Mark Gross <markgross@xxxxxxxxxx>; Vadim Pasternak
> <vadimp@xxxxxxxxxx>; platform-driver-x86@xxxxxxxxxxxxxxx; kernel-
> janitors@xxxxxxxxxxxxxxx
> 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@xxxxxxxxxx>

Acked-by: Michael Shych <michaelsh@xxxxxxxxxx>

> ---
>  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





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux