If reegulator is already enabled, it will be return to EALREADY.
But driver that its function is called can notice as error, even though
it's working fine.

Fixes: 4fcba5d556b ("regulator: implement basic reference counter")

Signed-off-by: Jaehoon Chung <[email protected]>
---
 drivers/power/regulator/regulator-uclass.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/power/regulator/regulator-uclass.c 
b/drivers/power/regulator/regulator-uclass.c
index 3a6ba69f6d5f..fc1c3eb93c9d 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -187,6 +187,10 @@ int regulator_set_enable(struct udevice *dev, bool enable)
                }
        }
 
+       /* Regulator is already enabled */
+       if (ret == -EALREADY)
+               return 0;
+
        return ret;
 }
 
-- 
2.25.1

Reply via email to