UPSTREAM: gpiolib: Fix error return code in gpiolib_dev_init()

Fix to return a negative error code from the error handling
case instead of 0, as done elsewhere in this function.

Fixes: 4731210c09f5 ("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>
(cherry picked from commit 3875721e825cf3ab05fc1a52b6cbd76c8d16da51)
Bug: 187129171
Signed-off-by: Connor O'Brien <connoro@google.com>
Change-Id: Ib4baa8a2e1952468f971dfb6fbdfefd827275519
This commit is contained in:
Wei Yongjun
2021-03-12 08:04:23 +00:00
committed by Connor O'Brien
parent 5f7ec0f4c3
commit a1cc08d515

View File

@@ -4396,7 +4396,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;