Re: [PATCH v4 12/20] power: supply: bq25890: Support higher charging voltages through Pump Express+ protocol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 31, 2022 at 04:18:23PM +0100, Hans de Goede wrote:
> On 1/31/22 14:48, Andy Shevchenko wrote:
> > On Sun, Jan 30, 2022 at 09:45:49PM +0100, Hans de Goede wrote:

...

> >> +	for (i = 0; i < PUMP_EXPRESS_MAX_TRIES; i++) {
> > 
> >> +		voltage = bq25890_get_vbus_voltage(bq);
> >> +		if (voltage < 0)
> >> +			goto error_print;
> > 
> > It also can be (at least in align with the rest error paths)
> > 
> > 		ret = bq25890_get_vbus_voltage(bq);
> > 		if (ret < 0)
> > 			goto error_print;
> > 		voltage = ret;
> > 
> > followed up (but not necessarily)...
> 
> The suggested pattern is useful when ret needs to be set on the error-exit
> path, but we are not doing that here. So I prefer to just keep this as is.

Are you talking about above proposal?

Still wouldn't be better to use it that if we want, for example, to print an
error code, it can be done easily? For the sake of consistency.

> >> +	}
> >> +
> >> +	bq25890_field_write(bq, F_PUMPX_EN, 0);
> >> +
> >> +	dev_info(bq->dev, "Hi-voltage charging requested, input voltage is %d mV\n",
> >> +		 voltage);
> > 
> >> +	return;
> >> +error_print:
> > 
> > 	if (ret < 0)
> > 
> > But it's up to you.
> > 
> >> +	dev_err(bq->dev, "Failed to request hi-voltage charging\n");

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux