Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp562920pxk; Wed, 2 Sep 2020 08:51:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzs1gWBcysW/h2jUL7Y6sU4Akz9g6VjjDs5yx9mHjFv5Y+5C/TNmKIq5phlKy4KU6okRZfa X-Received: by 2002:a50:bb65:: with SMTP id y92mr685977ede.53.1599061868277; Wed, 02 Sep 2020 08:51:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599061868; cv=none; d=google.com; s=arc-20160816; b=FB6lGPEv2XHBIvtxXVh7DnbffItgVdhj3k/KPlcEGzPJNSiozBRtuOV/sxMEcKLKrg AD7EYQnkbKZj3AkP6mnkQLrhPlKLpLlNVAarUv9YlM7soqjU7wGoiVp0hop7jShqBfh+ eCJ/GtrrDQrjl30w82qo63eXp+wUNVFCfIC74gIhIC66uGeAcJkdXG9CYc5zFGxBq3fb Voi4unWW6HHU6Wrm922uxmszIysUC0Sla3x24uR5uWuOwZXgsBhsGM8tNZ/n5fv4uBtB o7lBsfefN8VOq0K8xP+Z6YAr3o3DpQZr9r0HHIO/r+rKemiNW7NvSQ159+zKcstC91Z6 zevA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=PmRaqX8KGnniHzEGi+CSqdaLhvINm2xHB8H/MjY9N10=; b=RQ+BT6JkdemnuotuTJnpHYil8lqC3+6YnjIZ6/KVwbpeOWj4Au1MhS9PTKPm1aJPHX YCNGhqXuC8bQ30M/EJAQPUd/2hQNjis7YJSKTE2i99y5cUGMrOhjbAqV5kF5fFKxsoS/ yIo4cNpTZ/9vGtm3/h1mIffs4aepPdEK2sihbhlYfu38J/sbDNWUENqWqL/6GwD+Ghqs Nw2DlZv3zPU0b062c2bPENR1iefmueZUkKKzAbkB8DwDm1VJUmLONEvl6uNuHt6tV2Pt /Nh7gdyDtvUKUs4IIoOBJCRnSc553EIRww0mWFyvwjEK4sT55Xe/NXixCu/L1+58dk34 Oc5A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y16si2925930edq.199.2020.09.02.08.50.45; Wed, 02 Sep 2020 08:51:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728581AbgIBPrj (ORCPT + 99 others); Wed, 2 Sep 2020 11:47:39 -0400 Received: from youngberry.canonical.com ([91.189.89.112]:54363 "EHLO youngberry.canonical.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727088AbgIBNbh (ORCPT ); Wed, 2 Sep 2020 09:31:37 -0400 Received: from 1.general.cking.uk.vpn ([10.172.193.212] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1kDSr7-00023z-S9; Wed, 02 Sep 2020 13:31:17 +0000 From: Colin King To: Sebastian Reichel , Chanwoo Choi , Kyungmin Park , Myungjoo Ham , Anton Vorontsov , linux-pm@vger.kernel.org Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH][next] charger-manager: fix incorrect check on charging_duration_ms Date: Wed, 2 Sep 2020 14:31:17 +0100 Message-Id: <20200902133117.108025-1-colin.king@canonical.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Colin Ian King Currently the duration check on the discharging duration setting is checking the charging duration rather than the discharging duration due to a cut-n-paste coding error. Fix this by checking the value desc->charging_max_duration_ms. Addresses-Coverity: ("Copy-paste-error") Fixes: 8fcfe088e21a ("charger-manager: Support limit of maximum possible") Signed-off-by: Colin Ian King --- drivers/power/supply/charger-manager.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/power/supply/charger-manager.c b/drivers/power/supply/charger-manager.c index 07992821e252..44d919954e9e 100644 --- a/drivers/power/supply/charger-manager.c +++ b/drivers/power/supply/charger-manager.c @@ -471,7 +471,7 @@ static int check_charging_duration(struct charger_manager *cm) } else if (cm->battery_status == POWER_SUPPLY_STATUS_NOT_CHARGING) { duration = curr - cm->charging_end_time; - if (duration > desc->charging_max_duration_ms) { + if (duration > desc->discharging_max_duration_ms) { dev_info(cm->dev, "Discharging duration exceed %ums\n", desc->discharging_max_duration_ms); ret = true; -- 2.27.0