mirror of
https://github.com/torvalds/linux.git
synced 2024-11-23 12:42:02 +00:00
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: 8a39f597bc
("gpio: mockup: rework device probing")
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
parent
e0fc62a655
commit
c4b54e138a
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user