[PATCH] regulator: rk808: simplify one error branch with dev_err_probe

Sascha Hauer sha at pengutronix.de
Tue Jan 10 06:37:57 PST 2023


On Mon, Jan 09, 2023 at 06:59:09PM +0100, Ahmad Fatoum wrote:
> This has the added benefit of recording the error message.
> 
> Signed-off-by: Ahmad Fatoum <ahmad at a3f.at>
> ---
>  drivers/regulator/rk808-regulator.c | 7 +++----
>  1 file changed, 3 insertions(+), 4 deletions(-)

Applied, thanks

Sascha

> 
> diff --git a/drivers/regulator/rk808-regulator.c b/drivers/regulator/rk808-regulator.c
> index 3da6cca294ae..8c96b99c9be5 100644
> --- a/drivers/regulator/rk808-regulator.c
> +++ b/drivers/regulator/rk808-regulator.c
> @@ -783,10 +783,9 @@ static int rk808_regulator_register(struct rk808 *rk808, int id,
>  	cfg->rdev.regmap = rk808->regmap;
>  
>  	ret = of_regulator_register(&cfg->rdev, match->of_node);
> -	if (ret) {
> -		dev_err(dev, "failed to register %s regulator\n", match->name);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to register %s regulator\n",
> +				     match->name);
>  
>  	dev_dbg(dev, "registered %s\n", match->name);
>  
> -- 
> 2.38.1
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list