From: Wei Yongjun <weiyj.lk@gmail.com>
To: Vadim Pasternak <vadimp@mellanox.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
x86@kernel.org, platform-driver-x86@vger.kernel.org
Subject: [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init()
Date: Sat, 24 Sep 2016 11:56:14 +0000 [thread overview]
Message-ID: <1474718174-10818-1-git-send-email-weiyj.lk@gmail.com> (raw)
From: Wei Yongjun <weiyongjun1@huawei.com>
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 <weiyongjun1@huawei.com>
---
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);
next reply other threads:[~2016-09-24 11:56 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-24 11:56 Wei Yongjun [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-09-24 11:48 [PATCH -next] x86/platform/mellanox: Fix return value check in mlxplat_init() Wei Yongjun
2016-09-24 13:33 ` Vadim Pasternak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1474718174-10818-1-git-send-email-weiyj.lk@gmail.com \
--to=weiyj.lk@gmail.com \
--cc=hpa@zytor.com \
--cc=mingo@redhat.com \
--cc=platform-driver-x86@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=vadimp@mellanox.com \
--cc=weiyongjun1@huawei.com \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox