public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Gustavo A. R. Silva" <gustavoars@kernel.org>
To: Randy Dunlap <rdunlap@infradead.org>
Cc: Sebastian Reichel <sre@kernel.org>,
	Jonathan Bakker <xc-racer2@live.ca>,
	Krzysztof Kozlowski <krzk@kernel.org>,
	Jonghwa Lee <jonghwa3.lee@samsung.com>,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
	Colin Ian King <colin.king@canonical.com>
Subject: Re: [PATCH v2] power: supply: charger-manager: Fix info message in check_charging_duration()
Date: Wed, 2 Sep 2020 11:43:44 -0500	[thread overview]
Message-ID: <20200902164344.GC31464@embeddedor> (raw)
In-Reply-To: <f93c0fa0-51a1-291f-feda-fbd8d7397e88@infradead.org>

On Wed, Sep 02, 2020 at 09:29:31AM -0700, Randy Dunlap wrote:
> On 9/2/20 9:23 AM, Gustavo A. R. Silva wrote:
> > A few months ago, commit e132fc6bb89b ("power: supply: charger-manager: Make decisions focussed on battery status")
> > changed the expression in the if statement from "duration > desc->discharging_max_duration_ms"
> > to "duration > desc->charging_max_duration_ms", but the arguments for dev_info() were left unchanged.
> > Apparently, due to a copy-paste error.
> > 
> > Fix this by using the proper arguments for dev_info().
> > 
> > Also, while there, replace "exceed" with "exceeds", for both messages.
> > 
> > Addresses-Coverity-ID: 1496803 ("Copy-paste error")
> > Fixes: e132fc6bb89b ("power: supply: charger-manager: Make decisions focussed on battery status")
> > Signed-off-by: Gustavo A. R. Silva <gustavoars@kernel.org>
> > ---
> > Changes in v2:
> >  -  Replace "exceed" with "exceeds"
> > 
> >  drivers/power/supply/charger-manager.c | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c
> > index 07992821e252..a6d5dbd55e37 100644
> > --- a/drivers/power/supply/charger-manager.c
> > +++ b/drivers/power/supply/charger-manager.c
> > @@ -464,7 +464,7 @@ static int check_charging_duration(struct charger_manager *cm)
> >  		duration = curr - cm->charging_start_time;
> >  
> >  		if (duration > desc->charging_max_duration_ms) {
> > -			dev_info(cm->dev, "Charging duration exceed %ums\n",
> > +			dev_info(cm->dev, "Charging duration exceeds %ums\n",
> >  				 desc->charging_max_duration_ms);
> >  			ret = true;
> >  		}
> > @@ -472,8 +472,8 @@ static int check_charging_duration(struct charger_manager *cm)
> >  		duration = curr - cm->charging_end_time;
> >  
> >  		if (duration > desc->charging_max_duration_ms) {
> > -			dev_info(cm->dev, "Discharging duration exceed %ums\n",
> > -				 desc->discharging_max_duration_ms);
> > +			dev_info(cm->dev, "Charging duration exceeds %ums\n",
> > +				 desc->charging_max_duration_ms);
> >  			ret = true;
> >  		}
> >  	}
> > 
> 
> Hi,
> 
> It looks to me like the second block (else if) should be about discharging,
> not charging, more like Colin King's patch had it:
>

I had the same impression for a moment, but what makes me think this is
more about charging than discharging, is this line:

471         } else if (cm->battery_status == POWER_SUPPLY_STATUS_NOT_CHARGING) {

which was introduced by the same commit:

e132fc6bb89b ("power: supply: charger-manager: Make decisions focussed on battery status")

let's find out... :)

Thanks
--
Gustavo

  reply	other threads:[~2020-09-02 16:37 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 16:23 [PATCH v2] power: supply: charger-manager: Fix info message in check_charging_duration() Gustavo A. R. Silva
2020-09-02 16:29 ` Randy Dunlap
2020-09-02 16:43   ` Gustavo A. R. Silva [this message]
2020-09-02 16:46     ` Colin Ian King
2020-09-03  1:22       ` Jonathan Bakker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902164344.GC31464@embeddedor \
    --to=gustavoars@kernel.org \
    --cc=colin.king@canonical.com \
    --cc=jonghwa3.lee@samsung.com \
    --cc=krzk@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rdunlap@infradead.org \
    --cc=sre@kernel.org \
    --cc=xc-racer2@live.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox