RE: [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init()

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

 




> -----Original Message-----
> From: Wei Yongjun [mailto:weiyj.lk@xxxxxxxxx]
> Sent: Saturday, September 24, 2016 2:48 PM
> To: Vadim Pasternak <vadimp@xxxxxxxxxxxx>; Thomas Gleixner
> <tglx@xxxxxxxxxxxxx>; Ingo Molnar <mingo@xxxxxxxxxx>; H. Peter Anvin
> <hpa@xxxxxxxxx>
> Cc: Wei Yongjun <weiyongjun1@xxxxxxxxxx>; x86@xxxxxxxxxx; platform-
> driver-x86@xxxxxxxxxxxxxxx
> Subject: [PATCH -next] x86/platform/mellanox: Fix return value check in
> mlxplat_init()
> 
> From: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
> 
> In case of error, the function platform_device_register_simple() returns
> ERR_PTR() and never returns NULL. The NULL test in the return value check
> should be replaced with IS_ERR().
> 
> Signed-off-by: Wei Yongjun <weiyongjun1@xxxxxxxxxx>
> ---
>  arch/x86/platform/mellanox/mlx-platform.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/platform/mellanox/mlx-platform.c
> b/arch/x86/platform/mellanox/mlx-platform.c
> index e1dc152..7dcfcca 100644
> --- a/arch/x86/platform/mellanox/mlx-platform.c
> +++ b/arch/x86/platform/mellanox/mlx-platform.c
> @@ -200,8 +200,8 @@ static int __init mlxplat_init(void)
>  					mlxplat_lpc_resources,
>  					ARRAY_SIZE(mlxplat_lpc_resources));
> 
> -	if (!mlxplat_dev)
> -		return -ENOMEM;
> +	if (IS_ERR(mlxplat_dev))
> +		return PTR_ERR(mlxplat_dev);
> 

Acked-by: Vadim Pasternak <vadimp@xxxxxxxxxxxx>

>  	priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv),
>  			    GFP_KERNEL);

--
To unsubscribe from this list: send the line "unsubscribe platform-driver-x86" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux