power: supply: charger-manager: fix incorrect check on charging_duration_ms
authorColin Ian King <colin.king@canonical.com>
Wed, 2 Sep 2020 13:31:17 +0000 (14:31 +0100)
committerSebastian Reichel <sre@kernel.org>
Thu, 8 Oct 2020 22:33:09 +0000 (00:33 +0200)
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 <colin.king@canonical.com>
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/charger-manager.c

index b2ca791..6fcebe4 100644 (file)
@@ -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;