mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-06 05:06:13 +02:00
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 <eugen.hristev@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>
This commit is contained in:
parent
29fca9f23a
commit
8202bc2945
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user