RE: [PATCH] platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue

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

 




> -----Original Message-----
> From: Dan Carpenter [mailto:dan.carpenter@xxxxxxxxxx]
> Sent: Tuesday, February 06, 2018 2:46 PM
> To: Vadim Pasternak <vadimp@xxxxxxxxxxxx>
> Cc: Darren Hart <dvhart@xxxxxxxxxxxxx>; Andy Shevchenko
> <andy@xxxxxxxxxxxxx>; platform-driver-x86@xxxxxxxxxxxxxxx; kernel-
> janitors@xxxxxxxxxxxxxxx
> Subject: [PATCH] platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue
> 
> devm_ioport_map() returns NULL on error but we accidentally check for error
> pointers instead.
> 
> Fixes: c6acad68eb2d ("platform/mellanox: mlxreg-hotplug: Modify to use a
> regmap interface")
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>

Acked-by: Vadim Pasternak <vadimp@xxxxxxxxxxx>

> 
> diff --git a/drivers/platform/x86/mlx-platform.c b/drivers/platform/x86/mlx-
> platform.c
> index dfecba4407ac..27de29961f5e 100644
> --- a/drivers/platform/x86/mlx-platform.c
> +++ b/drivers/platform/x86/mlx-platform.c
> @@ -522,8 +522,8 @@ static int __init mlxplat_init(void)
> 
>  	mlxplat_mlxcpld_regmap_ctx.base = devm_ioport_map(&mlxplat_dev-
> >dev,
>  			       mlxplat_lpc_resources[1].start, 1);
> -	if (IS_ERR(mlxplat_mlxcpld_regmap_ctx.base)) {
> -		err = PTR_ERR(mlxplat_mlxcpld_regmap_ctx.base);
> +	if (!mlxplat_mlxcpld_regmap_ctx.base) {
> +		err = -ENOMEM;
>  		goto fail_platform_mux_register;
>  	}
> 
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux