Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 65f74222 authored by Wei Yongjun's avatar Wei Yongjun Committed by Thomas Gleixner
Browse files

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: default avatarWei Yongjun <weiyongjun1@huawei.com>
Acked-by: default avatarVadim Pasternak <vadimp@mellanox.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 58cbbee2
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -200,8 +200,8 @@ static int __init mlxplat_init(void)
					mlxplat_lpc_resources,
					mlxplat_lpc_resources,
					ARRAY_SIZE(mlxplat_lpc_resources));
					ARRAY_SIZE(mlxplat_lpc_resources));


	if (!mlxplat_dev)
	if (IS_ERR(mlxplat_dev))
		return -ENOMEM;
		return PTR_ERR(mlxplat_dev);


	priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv),
	priv = devm_kzalloc(&mlxplat_dev->dev, sizeof(struct mlxplat_priv),
			    GFP_KERNEL);
			    GFP_KERNEL);