X86 platform drivers
 help / color / mirror / Atom feed
* [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init()
@ 2016-09-24 11:48 Wei Yongjun
  2016-09-24 13:33 ` Vadim Pasternak
  0 siblings, 1 reply; 3+ messages in thread
From: Wei Yongjun @ 2016-09-24 11:48 UTC (permalink / raw)
  To: Vadim Pasternak, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Wei Yongjun, x86, platform-driver-x86

From: Wei Yongjun <weiyongjun1@huawei.com>

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@huawei.com>
---
 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);
 
 	priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv),
 			    GFP_KERNEL);

^ permalink raw reply related	[flat|nested] 3+ messages in thread
* [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init()
@ 2016-09-24 11:56 Wei Yongjun
  0 siblings, 0 replies; 3+ messages in thread
From: Wei Yongjun @ 2016-09-24 11:56 UTC (permalink / raw)
  To: Vadim Pasternak, Thomas Gleixner, Ingo Molnar, H. Peter Anvin
  Cc: Wei Yongjun, x86, platform-driver-x86

From: Wei Yongjun <weiyongjun1@huawei.com>

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@huawei.com>
---
 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);
 
 	priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv),
 			    GFP_KERNEL);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-09-24 16:06 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-24 11:48 [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init() Wei Yongjun
2016-09-24 13:33 ` Vadim Pasternak
  -- strict thread matches above, loose matches on Subject: below --
2016-09-24 11:56 Wei Yongjun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox