From: Bartosz Golaszewski <brgl@bgdev.pl>
To: Linus Walleij <linus.walleij@linaro.org>
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
Bartosz Golaszewski <brgl@bgdev.pl>
Subject: [PATCH] gpio: mockup: fix a return value check
Date: Wed, 6 Dec 2017 17:30:02 +0100 [thread overview]
Message-ID: <20171206163002.26742-1-brgl@bgdev.pl> (raw)
The return value of platform_device_register_resndata() on error is
an error code converted to pointer with ERR_PTR(), not NULL.
Check the return value correctly.
Fixes: 8a39f597bcfd ("gpio: mockup: rework device probing")
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
drivers/gpio/gpio-mockup.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index ea8c730d8af1..3a545ad17817 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -387,11 +387,11 @@ static int __init gpio_mockup_init(void)
GPIO_MOCKUP_NAME,
i, NULL, 0, &pdata,
sizeof(pdata));
- if (!pdev) {
+ if (IS_ERR(pdev)) {
gpio_mockup_err("error registering device");
platform_driver_unregister(&gpio_mockup_driver);
gpio_mockup_unregister_pdevs();
- return -ENOMEM;
+ return PTR_ERR(pdev);
}
gpio_mockup_pdevs[i] = pdev;
--
2.15.1
next reply other threads:[~2017-12-06 16:30 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-06 16:30 Bartosz Golaszewski [this message]
2017-12-08 14:34 ` [PATCH] gpio: mockup: fix a return value check Linus Walleij
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=20171206163002.26742-1-brgl@bgdev.pl \
--to=brgl@bgdev.pl \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.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