From: Eugen Hristev Date: Wed, 19 Apr 2023 13:45:26 +0000 (+0300) Subject: regulator: handle different error codes in regulator_set_enable_if_allowed X-Git-Url: http://git.dujemihanovic.xyz/html/%7B%7B%20%28.OutputFormats.Get?a=commitdiff_plain;h=8202bc29454cfdd5839058e4b79c36a3fbb221cf;p=u-boot.git regulator: handle different error codes in regulator_set_enable_if_allowed The regulator core can return different codes which are not considered a real error for this function. Return success in such cases. Signed-off-by: Eugen Hristev Reviewed-by: Simon Glass Reviewed-by: Patrice Chotard --- diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c index d608f7c236..3a6ba69f6d 100644 --- a/drivers/power/regulator/regulator-uclass.c +++ b/drivers/power/regulator/regulator-uclass.c @@ -197,6 +197,12 @@ int regulator_set_enable_if_allowed(struct udevice *dev, bool enable) ret = regulator_set_enable(dev, enable); if (ret == -ENOSYS || ret == -EACCES) return 0; + /* if we want to disable but it's in use by someone else */ + if (!enable && ret == -EBUSY) + return 0; + /* if it's already enabled/disabled */ + if (ret == -EALREADY) + return 0; return ret; }