x86/platform/mellanox: Fix return value check in mlxplat_init()
Subsystems (2)
PATCH 1/1 x86/platform/mellanox: Fix return value check in mlxplat_init()
From: Wei Yongjun <[email protected]>
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().
--- arch/x86/platform/mellanox/mlx-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/platform/mellanox/mlx-platform.c +2 -2
@@ -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 );
Quoted 30 lines
-----Original Message-----
From: Wei Yongjun [mailto:[email protected]]
Sent: Saturday, September 24, 2016 2:48 PM
To: Vadim Pasternak <[email protected]>; Thomas Gleixner <[email protected]>; Ingo Molnar <[email protected]>; H. Peter Anvin <[email protected]>
Cc: Wei Yongjun <[email protected]>; [email protected]; platform- [email protected]
Subject: [PATCH -next] x86/platform/mellanox: Fix return value check inmlxplat_init()From: Wei Yongjun <[email protected]>
In case of error, the function
platform_device_register_simple()returnsERR_PTR()and never returns NULL. The NULL test in the return value check should be replaced withIS_ERR().Signed-off-by Wei Yongjun <[email protected]>--- arch/x86/platform/mellanox/mlx-platform.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)arch/x86/platform/mellanox/mlx-platform.c +0
-0
arch/x86/platform/mellanox/mlx-platform.c static int __init mlxplat_init(void) · line 205
Quoted 8 lines
arch/x86/platform/mellanox/mlx-platform.c +2
-2@@ -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);
Quoted 2 lines
arch/x86/platform/mellanox/mlx-platform.c +0
-0priv =devm_kzalloc (&mlxplat_dev->dev,sizeof (struct mlxplat_priv ),GFP_KERNEL );