Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp973273ybs; Mon, 25 May 2020 04:08:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydjAN4zPoBlZZq4J3JjHqQcVJ3VpE6zLrzfzIV/rPZ8smV+ksjeZKzbQbDGtgAQEpvjItE X-Received: by 2002:aa7:d1c6:: with SMTP id g6mr14805822edp.303.1590404882531; Mon, 25 May 2020 04:08:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590404882; cv=none; d=google.com; s=arc-20160816; b=sbICkm+mT18sJgXwUIt/oMiSbkonGgJg/dYJuM/sFglhjFmt+anqa+/sqkylhrnuyT /mAGF8MmMoKlDNOaKGvJzWvNjk/Kil3XE4eDWSS17q9fL99WyJlWYeayzuXWyR2lE15Q Dbp0OkrCJgxsLk8bD55MwXg4sSsoC9Nfjf5huTV0YUNL9GrXiue55OMebcS93IZRwUod 1mDEfOUb53+r/oWrdGY7tcj2v/1uNEsw30qz7p+lXsuzR3TOu6YOLH78sdUVH8HIGvwr t6fl24uXn7hJuLx3UQZmrVYZuuCHfKp4D5e4MOYdbEn4fFbnHWMK+u6XonZxyOW/3G0m JvCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=GUNcAEkkStkqVpOHwmsrMQ2UzPeUaBkdGeCZr3ufRoo=; b=r5UEu/uFBmwzlJ+LUhiBQbA1XflxtDbmxgZptRPjCv74Epzm0IwqjaYS6ydipcHR7V iUXDUHpHQZPpWfzUestaX5UkCINk3OaTEuS4v1VOz4u0rJV2TL5tZUsgMCO4GIB9cpwF Y67qzcMtcUHp2av0hbvfPCx1n8dPXMH3ULkeGdR+DtcLK3jta7MgvaG6NlwD+pjiObNR G1t4lFW1VV/S4SCFykUFydrbpJNIWt+lLbelqSqPyWkqQeGzacgjvDgJlPrH4/8j+5Vh we/j0w9/E/FlSjhp2eJ9ujrjKyBHa6kEdd1gO+dHlzuWmgtFhO/rYb50oKBXMzvuLXE/ a3jg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v26si9127692eda.549.2020.05.25.04.07.39; Mon, 25 May 2020 04:08:02 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390022AbgEYLFv (ORCPT + 99 others); Mon, 25 May 2020 07:05:51 -0400 Received: from mail.zju.edu.cn ([61.164.42.155]:62642 "EHLO zju.edu.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2389897AbgEYLFv (ORCPT ); Mon, 25 May 2020 07:05:51 -0400 Received: from localhost.localdomain (unknown [222.205.77.158]) by mail-app2 (Coremail) with SMTP id by_KCgBnEb2Epste7jMFAA--.16764S4; Mon, 25 May 2020 19:05:44 +0800 (CST) From: Dinghao Liu To: dinghao.liu@zju.edu.cn, kjlu@umn.edu Cc: Sebastian Reichel , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error Date: Mon, 25 May 2020 19:05:40 +0800 Message-Id: <20200525110540.6949-1-dinghao.liu@zju.edu.cn> X-Mailer: git-send-email 2.17.1 X-CM-TRANSID: by_KCgBnEb2Epste7jMFAA--.16764S4 X-Coremail-Antispam: 1UD129KBjvdXoWrKrW5ZF15Jr17CrWrKFy7trb_yoWDArb_C3 y8Zas29rs8Wr42ywnrGw4rZry09r9rXryxWr48tr13ta4j9F1DJr18ZF98ZF45WFWUCrZ8 ta98KF93AryDujkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbIkFc2x0x2IEx4CE42xK8VAvwI8IcIk0rVWrJVCq3wAFIxvE14AK wVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK021l84ACjcxK6xIIjxv20x vE14v26w1j6s0DM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4UJVWxJr1l84ACjcxK6I8E 87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_GcCE3s1le2I262IYc4CY6c 8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx0E2Ix0cI8IcVAFwI0_Jr0_ Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWUJVW8JwACjcxG0xvY0x0EwI xGrwACjI8F5VA0II8E6IAqYI8I648v4I1lc2xSY4AK67AK6r4kMxAIw28IcxkI7VAKI48J MxAIw28IcVCjz48v1sIEY20_GFWkJr1UJwCFx2IqxVCFs4IE7xkEbVWUJVW8JwC20s026c 02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF1VAFwI0_JF0_ Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6xIIjxv20xvEc7 CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6rWUJVWrZr1UMIIF0xvEx4A2jsIE 14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxhVjvjDU0xZFpf 9x0JUqZXOUUUUU= X-CM-SenderInfo: qrrzjiaqtzq6lmxovvfxof0/1tbiAgEJBlZdtORShQA+s+ Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org pm_runtime_get_sync() increments the runtime PM usage counter even it returns an error code. Thus a pairing decrement is needed on the error handling path to keep the counter balanced. Signed-off-by: Dinghao Liu --- Changelog: v2: - Use pm_runtime_put_noidle() rather than pm_runtime_put_autosuspend(). --- drivers/power/supply/bq24190_charger.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/power/supply/bq24190_charger.c b/drivers/power/supply/bq24190_charger.c index 453d6332d43a..7b24c41a2137 100644 --- a/drivers/power/supply/bq24190_charger.c +++ b/drivers/power/supply/bq24190_charger.c @@ -481,8 +481,10 @@ static ssize_t bq24190_sysfs_store(struct device *dev, return ret; ret = pm_runtime_get_sync(bdi->dev); - if (ret < 0) + if (ret < 0) { + pm_runtime_put_noidle(bdi->dev); return ret; + } ret = bq24190_write_mask(bdi, info->reg, info->mask, info->shift, v); if (ret) -- 2.17.1