From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E5662C433E7 for ; Wed, 2 Sep 2020 16:37:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C0EB2206E7 for ; Wed, 2 Sep 2020 16:37:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599064656; bh=Wni3x+GYLltlmuMdPoBYORxVVeiXa3j+1KYJ4MzXN9M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=oFJMi2o8BEwXk/BmOgubNxG9Nipn/l2r9pLUUtZq+p5j/Ya6a/DaNk8cj9+pbWb3D CCMFU0Sn8acY46LbGFyT0SAG0o52kUQg2EbGwS5fUpYJyBnYQ2OzV4ajgnKfqzeX7L l8t73hfCt0S1mIwVqjxDxUFuIiI6K3ECuAEAAbk8= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727800AbgIBQhf (ORCPT ); Wed, 2 Sep 2020 12:37:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:43012 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726173AbgIBQhd (ORCPT ); Wed, 2 Sep 2020 12:37:33 -0400 Received: from embeddedor (187-162-31-110.static.axtel.net [187.162.31.110]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 00E87206E7; Wed, 2 Sep 2020 16:37:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599064652; bh=Wni3x+GYLltlmuMdPoBYORxVVeiXa3j+1KYJ4MzXN9M=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=VCqXUbtn8+j07T3SZla2H1AsOoHroyVvb//SzsI9m+cc21OlcAttpbm1t3jLtbgl8 4YggRDJ6lvhZ4riGctIq6GUbyY3ncSoW3ny/T3BG7oRb0Wnfk1YlgkfsRefZ7xQ4ks ucrwKYsyDVqpArW9sIVvT8vj6aKq36VQqf8CdRlY= Date: Wed, 2 Sep 2020 11:43:44 -0500 From: "Gustavo A. R. Silva" To: Randy Dunlap Cc: Sebastian Reichel , Jonathan Bakker , Krzysztof Kozlowski , Jonghwa Lee , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, Colin Ian King Subject: Re: [PATCH v2] power: supply: charger-manager: Fix info message in check_charging_duration() Message-ID: <20200902164344.GC31464@embeddedor> References: <20200902162315.GA11384@embeddedor> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 > > --- > > 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