From patchwork Tue Sep 29 11:00:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 263267 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=-13.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham 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 B62FFC4727F for ; Tue, 29 Sep 2020 11:41:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 756AF2065C for ; Tue, 29 Sep 2020 11:41:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379713; bh=hHbpTSTPz6WKT02bLRF/XYFd6t/ARAuXZH0O+Ip4sXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=PPSL4aBteDtAyNjo8Y77e4L8hnK6hcr9ByYJwtRabQpufeDgw6sPAv3hQxUkYKs4L MXtigHXudEDrbL/jfVEx60uJ3APEhmn1CnMl1WAqKDfIh+clPFphj93RO+DWPJ8/Gq 4xorj4uojIbvLRiJIYfHGLQcyZc0k2h8B7rYC2O4= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729724AbgI2Llw (ORCPT ); Tue, 29 Sep 2020 07:41:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:38626 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729305AbgI2Llp (ORCPT ); Tue, 29 Sep 2020 07:41:45 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (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 A8949206A5; Tue, 29 Sep 2020 11:41:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1601379705; bh=hHbpTSTPz6WKT02bLRF/XYFd6t/ARAuXZH0O+Ip4sXM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=c1r+8IZucUy8Bf+KHIV0rY7I8QuFgDg9cmc0rik7uajF848XEW6YcCdDd6pnDjXax AjDpvCSKKvUefGInoFXXW4ZJwzf9EfRfSNiit2xgzyAsMPD0VjUperQXF+yaKqZBPH pqSLcH9+cFaHNKg5FpqB/rEXxSRT+RgtsVpArkj0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dinghao Liu , Linus Walleij , Sasha Levin Subject: [PATCH 5.4 280/388] gpio: rcar: Fix runtime PM imbalance on error Date: Tue, 29 Sep 2020 13:00:11 +0200 Message-Id: <20200929110024.008806976@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200929110010.467764689@linuxfoundation.org> References: <20200929110010.467764689@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Dinghao Liu [ Upstream commit 6f8cd246411575703d9312888b70705c396b53a9 ] pm_runtime_get_sync() increments the runtime PM usage counter even when 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 Link: https://lore.kernel.org/r/20200522080839.32612-1-dinghao.liu@zju.edu.cn Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-rcar.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpio/gpio-rcar.c b/drivers/gpio/gpio-rcar.c index 187984d26f47a..f0b6c68e848e3 100644 --- a/drivers/gpio/gpio-rcar.c +++ b/drivers/gpio/gpio-rcar.c @@ -250,8 +250,10 @@ static int gpio_rcar_request(struct gpio_chip *chip, unsigned offset) int error; error = pm_runtime_get_sync(p->dev); - if (error < 0) + if (error < 0) { + pm_runtime_put(p->dev); return error; + } error = pinctrl_gpio_request(chip->base + offset); if (error)