From: Venkatesh Yadav Abbarapu Date: Mon, 25 Nov 2024 04:11:59 +0000 (+0530) Subject: usb: onboard-hub: Fix the return values of regulator APIs X-Git-Url: http://git.dujemihanovic.xyz/html/%7B%7B%20.RelPermalink%20%7D%7D?a=commitdiff_plain;h=5fdce1fa1783fb0cada91b17cd341f026521c3d9;p=u-boot.git usb: onboard-hub: Fix the return values of regulator APIs Don't error out if there is no vdd regulator supply, as these are optional properties. Signed-off-by: Venkatesh Yadav Abbarapu Reviewed-by: Marek Vasut --- diff --git a/common/usb_onboard_hub.c b/common/usb_onboard_hub.c index e4d1f12cb4..812e7749de 100644 --- a/common/usb_onboard_hub.c +++ b/common/usb_onboard_hub.c @@ -57,14 +57,18 @@ static int usb_onboard_hub_probe(struct udevice *dev) int ret; ret = device_get_supply_regulator(dev, "vdd-supply", &hub->vdd); - if (ret) { + if (ret && ret != -ENOENT) { dev_err(dev, "can't get vdd-supply: %d\n", ret); return ret; } - ret = regulator_set_enable_if_allowed(hub->vdd, true); - if (ret) - dev_err(dev, "can't enable vdd-supply: %d\n", ret); + if (hub->vdd) { + ret = regulator_set_enable_if_allowed(hub->vdd, true); + if (ret && ret != -ENOSYS) { + dev_err(dev, "can't enable vdd-supply: %d\n", ret); + return ret; + } + } return usb_onboard_hub_reset(dev); }