Re: bq2415x_charger: Use common error handling code in bq2415x_timer_work()

From: Pali RohÃr
Date: Thu Nov 09 2017 - 08:14:42 EST


On Thursday 09 November 2017 14:04:19 SF Markus Elfring wrote:
> > Better fix would be to display separate messages; user is probably
> > interested in what failed...
>
> Which information (or wording) would you find more appropriate
> at these places?

Hi! Basically dropping your patch and instead of the "Unknown error"
return to user reason why BQ2415X_BOOST_MODE_STATUS or
BQ2415X_FAULT_STATUS commands failed. Or at least instead of the
"Unknown error" write "Unknown error during BQ2415X_FAULT_STATUS".

Basically I do not see any value in your patch. Current coding style
pattern in that function is:

do_something;
if failed:
print error;
return;

And your patch just changed some, but not *all* parts of code to:

do_something;
if failed:
goto end_of_function

If you are changing coding style, I would really suggest to change it on
all places to let it consistent. Because your change introduces just
inconsistency.

--
Pali RohÃr
pali.rohar@xxxxxxxxx