diff options
author | Bartosz Golaszewski <brgl@bgdev.pl> | 2017-12-06 17:30:02 +0100 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2017-12-08 15:34:15 +0100 |
commit | c4b54e138a2610b02cd655deddefa793c1871ef8 (patch) | |
tree | 29f240077dea86440bda9fc455e047c6b2805bd2 /drivers/gpio/gpio-mockup.c | |
parent | e0fc62a6552f3d9c21e73cc65844f9aad1892cf7 (diff) | |
download | lwn-c4b54e138a2610b02cd655deddefa793c1871ef8.tar.gz lwn-c4b54e138a2610b02cd655deddefa793c1871ef8.zip |
gpio: mockup: fix a return value check
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>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio/gpio-mockup.c')
-rw-r--r-- | drivers/gpio/gpio-mockup.c | 4 |
1 files 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; |