Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp976273ybs; Mon, 25 May 2020 04:12:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRkNEzTIweOsDqoHDC/V/WI0GXTN0r75CuHybflP7z4d4Br3RrpqUmNqLti3cyyU84s5Dq X-Received: by 2002:a17:906:4317:: with SMTP id j23mr17784998ejm.377.1590405146087; Mon, 25 May 2020 04:12:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590405146; cv=none; d=google.com; s=arc-20160816; b=lQwM9Wn7wuRunirQEQZmjiUnm4QP5hn7086l0aCXkdRMoGWD2hW6eilvTAYTYWb+7/ df1KHuVP3Z02Hn+CMsdasdevA21+yBTDJ2YW5vBs2prC0v9f9xCzUDnfHRH1bbbwCPdj Ap/gL4nJsvACqnDLJeczUPZmnbIdt1uzeLZRydW/al1uQS/unR892yNuWRH8dLVAy5Ga fiI4EMXm96QZ88MV4S+e1zPVb/al9ArYAdhytviPPP5o1vyl6j+E1L75/JPKdNgnPpjD NwsQdBjrSyz6gLlnsb/J4GhCVF7EmkeHe+94Lkqbqhp4bWU1p5kkRUZZ+DBsv7upaWb/ maEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=SB0wil5McK190NuQj9OZqwjEId4UBlaUoJWnHA0mJ7Y=; b=dDh8hcH54Vwq492BOXVgNy0X0o/z3yAqOyRawylCOf+PkB2kNZSAiaVEU7W9eDCHow jD/rj+1DYie4rNo/uVSKBysRB1vYTLoZ8cW+RYqB9+X9pY6du/TcwKQamcdM8KEGK/Qs Lksh9mI1wt0pzxkMRsqHJM1CiFncpW+6T9OBjjySBaCwEPiHFNilKdmaqbyz+Lf1Uabm w9RojMgaSJmZnt5kvOKXcIg3ia5sbRO8m8dTIXZhsx5mWWOwU/pVqSxj3LAlGAWUC0HD Gl+7QKqE/UeYH3RYZH7wPX1+o+/HWQouHE+xi7EyMvE3pvcXmq9Ge7qihGyhbUdqrO1C nRqA== 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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i26si925058ejy.176.2020.05.25.04.12.03; Mon, 25 May 2020 04:12:26 -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=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390078AbgEYLJN (ORCPT + 99 others); Mon, 25 May 2020 07:09:13 -0400 Received: from mail-ot1-f65.google.com ([209.85.210.65]:45209 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389942AbgEYLJL (ORCPT ); Mon, 25 May 2020 07:09:11 -0400 Received: by mail-ot1-f65.google.com with SMTP id c3so13518843otr.12; Mon, 25 May 2020 04:09:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=SB0wil5McK190NuQj9OZqwjEId4UBlaUoJWnHA0mJ7Y=; b=tJZkYuy/83pyaG94T2GyhpZfTr/essjsHtK6rPaZ9eS87JXvjzDUfCRI98tA6odFCt F5wCr6J1rqLutKnPeqSq/kFDD8c0MXxPUZU1MGiI3PoCiYXQXlRLym/NmbuuVQ9lU92B ovGkXCounnw910c0l7JpSqZGPGvMLYlVCLJe2YUdbJfyfz5MBze7cChTHyxplDg70qxy nhmOO0oX2wJ+NkvbCGleXFSYnZP9jpoiVrpQFDHA/wyd9zldOloFGAvrG2Dx7BV64PZu m23VWjPGoaSHLecrCWHncjpPETYZ1rv1JhahvWQ45nAXBAKXkei5XS7tgWWnh90rAgH+ bPRg== X-Gm-Message-State: AOAM531OZ9Vr3Ux9zUNMuOUfkz4BQ+kTvmf693TrdcXkhOhs8/GZBFgC ouiXp5Nva4V/yuuYwfW3OEwyVdSOUyDXXJ5r12EAOA== X-Received: by 2002:a9d:4713:: with SMTP id a19mr1428590otf.167.1590404950954; Mon, 25 May 2020 04:09:10 -0700 (PDT) MIME-Version: 1.0 References: <20200525110540.6949-1-dinghao.liu@zju.edu.cn> In-Reply-To: <20200525110540.6949-1-dinghao.liu@zju.edu.cn> From: "Rafael J. Wysocki" Date: Mon, 25 May 2020 13:09:00 +0200 Message-ID: Subject: Re: [PATCH] [v2] power: supply: bq24190_charger: Fix runtime PM imbalance on error To: Dinghao Liu Cc: Kangjie Lu , Sebastian Reichel , Linux PM , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 25, 2020 at 1:05 PM Dinghao Liu wrote: > > 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 Better now: Reviewed-by: Rafael J. Wysocki > --- > > 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 >