[PATCH] regulator: preserve error code properly in regulator_list_autoset()

Dan Carpenter dan.carpenter at linaro.org
Wed Jul 26 09:01:21 CEST 2023


This code has a & vs && typo so it only preserves odd value error
codes and not even value error codes.

Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
---
 drivers/power/regulator/regulator-uclass.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/power/regulator/regulator-uclass.c b/drivers/power/regulator/regulator-uclass.c
index 3a6ba69f6d5f..52dd1bd3eafd 100644
--- a/drivers/power/regulator/regulator-uclass.c
+++ b/drivers/power/regulator/regulator-uclass.c
@@ -380,7 +380,7 @@ int regulator_list_autoset(const char *list_platname[],
 		ret = regulator_autoset_by_name(list_platname[i], &dev);
 		if (ret != -EMEDIUMTYPE && verbose)
 			regulator_show(dev, ret);
-		if (ret & !error)
+		if (ret && !error)
 			error = ret;
 
 		if (list_devp)
-- 
2.39.2



More information about the U-Boot mailing list