Skip to content

Commit

Permalink
gpiolib: Fix error return code in gpiolib_dev_init()
Browse files Browse the repository at this point in the history
Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 4731210 ("gpiolib: Bind gpio_device to a driver to enable fw_devlink=on by default")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
  • Loading branch information
Wei Yongjun authored and brgl committed Mar 12, 2021
1 parent b41ba2e commit 3875721
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpio/gpiolib.c
Original file line number Diff line number Diff line change
Expand Up @@ -4256,7 +4256,8 @@ static int __init gpiolib_dev_init(void)
return ret;
}

if (driver_register(&gpio_stub_drv) < 0) {
ret = driver_register(&gpio_stub_drv);
if (ret < 0) {
pr_err("gpiolib: could not register GPIO stub driver\n");
bus_unregister(&gpio_bus_type);
return ret;
Expand Down

0 comments on commit 3875721

Please sign in to comment.