All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] gpio: mockup: fix a return value check
@ 2017-12-06 16:30 Bartosz Golaszewski
  2017-12-08 14:34 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Bartosz Golaszewski @ 2017-12-06 16:30 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gpio: mockup: fix a return value check
  2017-12-06 16:30 [PATCH] gpio: mockup: fix a return value check Bartosz Golaszewski
@ 2017-12-08 14:34 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2017-12-08 14:34 UTC (permalink / raw)
  To: Bartosz Golaszewski; +Cc: linux-gpio, linux-kernel

On Wed, Dec 6, 2017 at 5:30 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> 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>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-08 14:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-06 16:30 [PATCH] gpio: mockup: fix a return value check Bartosz Golaszewski
2017-12-08 14:34 ` Linus Walleij

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.