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

Tom Rini trini at konsulko.com
Tue Aug 8 23:42:44 CEST 2023


On Wed, Jul 26, 2023 at 10:01:21AM +0300, Dan Carpenter wrote:

> 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>
> Reviewed-by: Simon Glass <sjg at chromium.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)

This then leads to the test power_regulator_autoset_list in
test/dm/regulator.c failing.  Simon, please take a look, thanks.

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20230808/ac37982d/attachment.sig>


More information about the U-Boot mailing list