]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
power: regulator: Fix incorrect use of binary and
authorAndrew Goodbody <andrew.goodbody@linaro.org>
Mon, 1 Sep 2025 15:00:46 +0000 (16:00 +0100)
committerPeng Fan <peng.fan@nxp.com>
Wed, 24 Sep 2025 16:04:02 +0000 (00:04 +0800)
In regulator_list_autoset there is a test for ret being non-zero and
error being zero but it uses the binary '&' instead of the logical '&&'
which could well lead to unexpected results. Correct this to use the
logical '&&' instead.

This issue found by Smatch.

Signed-off-by: Andrew Goodbody <andrew.goodbody@linaro.org>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Peng Fan <peng.fan@nxp.com>
drivers/power/regulator/regulator-uclass.c

index 2a59a1b79c2d8720591b6186c0a5bf12fda2dbbd..94c52cf555b295ecd7b99cb9eed30f11014bc769 100644 (file)
@@ -389,7 +389,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 && ret != -EALREADY && !error)
                        error = ret;
 
                if (list_devp)