From: Wei Yongjun Date: Sat, 24 Sep 2016 11:48:13 +0000 (+0000) Subject: x86/platform/mellanox: Fix return value check in mlxplat_init() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=65f7422288cd19c4a9202c4ac7a9cca673b9b2ea;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git x86/platform/mellanox: Fix return value check in mlxplat_init() 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 must therefor be replaced with IS_ERR(). Signed-off-by: Wei Yongjun Acked-by: Vadim Pasternak Cc: platform-driver-x86@vger.kernel.org Signed-off-by: Thomas Gleixner --- diff --git a/arch/x86/platform/mellanox/mlx-platform.c b/arch/x86/platform/mellanox/mlx-platform.c index e1dc1526b5f8..7dcfcca97399 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);