From: Wei Yongjun <weiyj.lk@gmail.com>
To: Wei-Ning Huang <wnhuang@google.com>,
Thierry Escande <thierry.escande@collabora.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Wei Yongjun <weiyongjun1@huawei.com>, linux-kernel@vger.kernel.org
Subject: [PATCH -next] firmware: Google VPD: Fix return value check in vpd_platform_init()
Date: Wed, 26 Apr 2017 13:42:52 +0000 [thread overview]
Message-ID: <20170426134252.17627-1-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().
Fixes: 049a59db34eb ("firmware: Google VPD sysfs driver")
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
drivers/firmware/google/vpd.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/google/vpd.c b/drivers/firmware/google/vpd.c
index 619f4ba..3ce8131 100644
--- a/drivers/firmware/google/vpd.c
+++ b/drivers/firmware/google/vpd.c
@@ -303,8 +303,8 @@ static int __init vpd_platform_init(void)
struct platform_device *pdev;
pdev = platform_device_register_simple("vpd", -1, NULL, 0);
- if (!pdev)
- return -ENODEV;
+ if (IS_ERR(pdev))
+ return PTR_ERR(pdev);
vpd_kobj = kobject_create_and_add("vpd", firmware_kobj);
if (!vpd_kobj)
reply other threads:[~2017-04-26 13:43 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20170426134252.17627-1-weiyj.lk@gmail.com \
--to=weiyj.lk@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=thierry.escande@collabora.com \
--cc=weiyongjun1@huawei.com \
--cc=wnhuang@google.com \
/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
all inboxes | Powered by JetHome®