Skip to content

Commit

Permalink
x86/platform/mellanox: Fix return value check in mlxplat_init()
Browse files Browse the repository at this point in the history
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 <weiyongjun1@huawei.com>
Acked-by: Vadim Pasternak <vadimp@mellanox.com>
Cc: platform-driver-x86@vger.kernel.org
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
  • Loading branch information
Wei Yongjun authored and Thomas Gleixner committed Sep 24, 2016
1 parent 58cbbee commit 65f7422
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/x86/platform/mellanox/mlx-platform.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 65f7422

Please sign in to comment.