[PATCH v2 5/5] power: regulator: tps65941: Add TPS65224 PMIC regulator support

Dan Carpenter dan.carpenter at linaro.org
Sat Mar 9 14:10:32 CET 2024


On Fri, Mar 08, 2024 at 02:40:11PM +0530, Dhruva Gole wrote:
> > +
> > +	if (val < 0 || val > mask)
> > +		return -EINVAL;
> 
> Probably combine this with below if's, eitherway is fine.
> 
> > +
> > +	if (val <= reg_base)
> > +		return base;
> > +
> > +	if (val >= reg_max)
> > +		return max;
> 
> Why all these if's when they can be elifs?
> 
> > +

This was just a cut and paste of my suggested code.  I really like my
code...  It's like a tortoise eating the three bears' food...  This is
invalid.  This is low.  This is high.  This poridge is just right.

regards,
dan carpenter



More information about the U-Boot mailing list