Skip to contentSkip to conversation

platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue

PATCH Applied Dan Carpenter 3 participants 3 messages Feb 6, 2018

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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")
drivers/platform/x86/mlx-platform.c +2 -2
index dfecba4407ac..27de29961f5e 100644
@@ -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;
 	}
 
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 2:46 PM
To: Vadim Pasternak <[email protected]>
Cc: Darren Hart <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; kernel- [email protected]
Subject: [PATCH] platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue

Quoted 6 lines

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

Quoted 18 lines
drivers/platform/x86/mlx- renamed from drivers/platform/x86/mlx-platform.c +0 -0

platform.c
index dfecba4407ac..27de29961f5e 100644

drivers/platform/x86/mlx-platform.c +2 -2
@@ -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;
 	}
Applied
#2 lore raw
Quoted 11 lines · Vadim Pasternak
Quoted 11 lines

-----Original Message-----
From: Dan Carpenter [mailto:[email protected]]
Sent: Tuesday, February 06, 2018 2:46 PM
To: Vadim Pasternak <[email protected]>
Cc: Darren Hart <[email protected]>; Andy Shevchenko <[email protected]>; [email protected]; kernel- [email protected]
Subject: [PATCH] platform/x86: mlx-platform: Fix an ERR_PTR vs NULL issue

Quoted 8 lines
Quoted 6 lines

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

Queued up for today's PR for 4.16. Thanks.

Signature · 2 lines
Darren Hart
VMware Open Source Technology Center