From mboxrd@z Thu Jan 1 00:00:00 1970 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.0 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,USER_AGENT_GIT autolearn=unavailable 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 25598C433F7 for ; Mon, 27 Jul 2020 14:19:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 0562E20825 for ; Mon, 27 Jul 2020 14:19:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859557; bh=ePzMsZXUTslGkSsNhaVZcjTY3pwqZrmfziQBGeiOnbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=sc+gCT2bUPoowDhmkxHKGMdvMTlkMx6F0C0Q9SMDVDocQHKoF2dxP+yo1q3JnjVKA 00CoMbhtbUogsagc+ijQ5MTT2tpAw7iZTo67msFehlmHLMwY0R18n96QX8nkCT28Eg 7TYGzhSpikyH99RxEKn0J/G4se6v1lQ4FoHBTpWI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731367AbgG0OTP (ORCPT ); Mon, 27 Jul 2020 10:19:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:47148 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730769AbgG0OTP (ORCPT ); Mon, 27 Jul 2020 10:19:15 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 5577D2083E; Mon, 27 Jul 2020 14:19:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1595859554; bh=ePzMsZXUTslGkSsNhaVZcjTY3pwqZrmfziQBGeiOnbY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UhydlO4sndCCvLScZd4JVgQHr74Hf6MV2zcDGcH2gp8KEyLq0Wqry55KndBaZfQg/ zVkbyUZa5ozgpFgQQAo1XCQXj11rlUocIdHhbLnZHqhxj1tl7RXaq0CiMIKfUpnAHu uURULHHYgZINZKwumtDc3qZWbzpy7goztn8LFt7M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Navid Emamdoost , Charles Keepax , Linus Walleij , Sasha Levin Subject: [PATCH 5.7 002/179] gpio: arizona: handle pm_runtime_get_sync failure case Date: Mon, 27 Jul 2020 16:02:57 +0200 Message-Id: <20200727134932.788426020@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200727134932.659499757@linuxfoundation.org> References: <20200727134932.659499757@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Navid Emamdoost [ Upstream commit e6f390a834b56583e6fc0949822644ce92fbb107 ] Calling pm_runtime_get_sync increments the counter even in case of failure, causing incorrect ref count. Call pm_runtime_put if pm_runtime_get_sync fails. Signed-off-by: Navid Emamdoost Acked-by: Charles Keepax Link: https://lore.kernel.org/r/20200605025207.65719-1-navid.emamdoost@gmail.com Signed-off-by: Linus Walleij Signed-off-by: Sasha Levin --- drivers/gpio/gpio-arizona.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpio/gpio-arizona.c b/drivers/gpio/gpio-arizona.c index 5640efe5e7504..7520a13b4c7ca 100644 --- a/drivers/gpio/gpio-arizona.c +++ b/drivers/gpio/gpio-arizona.c @@ -106,6 +106,7 @@ static int arizona_gpio_direction_out(struct gpio_chip *chip, ret = pm_runtime_get_sync(chip->parent); if (ret < 0) { dev_err(chip->parent, "Failed to resume: %d\n", ret); + pm_runtime_put(chip->parent); return ret; } } -- 2.25.1