From mboxrd@z Thu Jan 1 00:00:00 1970 From: Wei Yongjun Subject: [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init() Date: Sat, 24 Sep 2016 11:56:14 +0000 Message-ID: <1474718174-10818-1-git-send-email-weiyj.lk@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:36524 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751900AbcIXL43 (ORCPT ); Sat, 24 Sep 2016 07:56:29 -0400 Received: by mail-pf0-f195.google.com with SMTP id n24so6495603pfb.3 for ; Sat, 24 Sep 2016 04:56:29 -0700 (PDT) Sender: platform-driver-x86-owner@vger.kernel.org List-ID: To: Vadim Pasternak , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" Cc: Wei Yongjun , x86@kernel.org, platform-driver-x86@vger.kernel.org From: Wei Yongjun 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 --- 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);