Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp733749pxu; Wed, 2 Dec 2020 01:48:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJxrpTYDRHnoBKIaxjdxCDpW9I9pjk6GM35krNmc0Zqjc5p71BFa6hcjTCb0p5KIQoyAw9YO X-Received: by 2002:aa7:d41a:: with SMTP id z26mr1752135edq.267.1606902508761; Wed, 02 Dec 2020 01:48:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606902508; cv=none; d=google.com; s=arc-20160816; b=HpFUsty/GzQSRFMNAm92G2cyniKCkeqXfL1EIpEvXbOKvOhDW5yhtzrpRDs1+SHq/P 2jr2pAt2rSs/x7pFahckTdBl+ZNhIsUZ0nIcttngUNEjlbUnWHXNr92OrLeuF/djU5y7 gyQ9W+awFL8B62zNB6zX6WjLXg2OeTvY3GOjqptmHtP19JL/1BU5iTa8TsziXO8DnecG DJPb3uEWTyFB/+LBGIhx3M3vaR7x4JwB52Khe2+wqj1tMg/McRKVJVOD8QWno0lCUuud 9XdRk9zCxXYynSm+t3ohZKrwXMKyuOUODKkdEOKtqS57rChnhqPu2tETkftlr+YFfmKI KrXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=dAzfm1GPRmqmkkKCelIOFgT4CWV7j2OzoUKEFgOroWw=; b=iH/QIIeTGCv1lY4IthcnVicc44ELQ0KtVJU9of42OqYBMhwXxRgkcD+sEHb/LBPyrM 7XmU1qKugmefQPMH7H/yRQXDlnNLRHcjmP4083WK5ZANo0cDOLHOKcuOSDWM3bY7Zvm2 DLxxD6vAMQXp70+q/Z9QPHUMlFNqdxyfy+QKp/IwKyiJRBEd0Npf/3kVjd70PueJOZko 91zCo6Lq6fiRp39UDKNBpL90pBk+8sxKTLZAnPkieimPp3LpZEHMo0RLfUFQjW/C4jWD 52RgwLd09bgJJfn+NMh3qI+kwMxCTUaBTh2ISVk2tWAxJE4g73mQYObmqP5OqiPOWaDB umEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="Tgu/dQWL"; 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 w6si520925ejc.271.2020.12.02.01.48.05; Wed, 02 Dec 2020 01:48:28 -0800 (PST) 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; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b="Tgu/dQWL"; 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 S1728660AbgLBJqa (ORCPT + 99 others); Wed, 2 Dec 2020 04:46:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726708AbgLBJq3 (ORCPT ); Wed, 2 Dec 2020 04:46:29 -0500 Received: from mail-ed1-x542.google.com (mail-ed1-x542.google.com [IPv6:2a00:1450:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40071C0613D4 for ; Wed, 2 Dec 2020 01:45:49 -0800 (PST) Received: by mail-ed1-x542.google.com with SMTP id d18so2903944edt.7 for ; Wed, 02 Dec 2020 01:45:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=dAzfm1GPRmqmkkKCelIOFgT4CWV7j2OzoUKEFgOroWw=; b=Tgu/dQWLG7lUvAVYc/Qt+C6zK6ZEcWGuLwgfwY+PayGbyOwrL/t6wN+RH6+CISgGT0 mwGcrHRX4JOmf2H9t/79JLs7qc5tSsTl/e5z+LJd8yis+MOMJ5FPj+4Hqnng96v8htD4 Z9hTGWnp4q4kpaY7BOIbL0kjBHx2HwlhNVvq1SMi1mOWEYdwvtTBjurLv19lWG+Pi4r/ ib9MTD2elJ/vutaBipPQTPaPPZPRuYUIMp0QWHx3ZSo9rEwygag/5IOSddn5gNS6W5Q1 wdJOaDq6/D1Zyz46Q2lchJYvPhKMdfEbPU6H04PLuHUXweKD1sjpta5PytP+nRpv7Rgl n8DA== 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=dAzfm1GPRmqmkkKCelIOFgT4CWV7j2OzoUKEFgOroWw=; b=SevO9n6ZPH+u0pBMrd1+odWpforAREVkw30K0FpEjDBji8kgFRqKiI6QPwhUuhwRAT 7rD2KB8xNELwII6ZclzSS1HdWp7g+s3khu0IrJijleNBeephbCibrepThK4RosfG4Cev m9a9W6iU8mIs3lYJZvFbVyaQMYIrB7AvrFEOdZibpMtJchob4TpVoFJQWbEakjftCfUN B49iNq1uArm7uxBaDXxR89yAJfxJee1IS9gZgruvR1hDI4lTCgWeD+CNOvhZRR32MO/o yTGFTqOeEcaD6VELNM5bwvbQgUubV8hoq51KBANy8UcNV8MOxfPhahtpmBx08g4F44gY mEzA== X-Gm-Message-State: AOAM530Dc4oPyEedASKeZULP7jG4jAihutfCJ2aZeTB2weP6jHGRVfRn QI8w5DOzBoy8yocQkQVMMEU3vHEzbZsI7lxJztuMmQ== X-Received: by 2002:a05:6402:307c:: with SMTP id bs28mr1782845edb.186.1606902347990; Wed, 02 Dec 2020 01:45:47 -0800 (PST) MIME-Version: 1.0 References: <20201127094445.121232-1-miaoqinglang@huawei.com> In-Reply-To: <20201127094445.121232-1-miaoqinglang@huawei.com> From: Bartosz Golaszewski Date: Wed, 2 Dec 2020 10:45:37 +0100 Message-ID: Subject: Re: [PATCH] gpio: zynq: fix reference leak in zynq_gpio functions To: Qinglang Miao Cc: Linus Walleij , Michal Simek , linux-gpio , arm-soc , LKML Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Nov 27, 2020 at 10:40 AM Qinglang Miao wrote: > > pm_runtime_get_sync will increment pm usage counter even it > failed. Forgetting to putting operation will result in a > reference leak here. > > A new function pm_runtime_resume_and_get is introduced in > [0] to keep usage counter balanced. So We fix the reference > leak by replacing it with new funtion. > > [0] dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter") > > Fixes: c2df3de0d07e ("gpio: zynq: properly support runtime PM for GPIO used as interrupts") > Reported-by: Hulk Robot > Signed-off-by: Qinglang Miao > --- > drivers/gpio/gpio-zynq.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c > index 0b5a17ab9..3521c1dc3 100644 > --- a/drivers/gpio/gpio-zynq.c > +++ b/drivers/gpio/gpio-zynq.c > @@ -574,7 +574,7 @@ static int zynq_gpio_irq_reqres(struct irq_data *d) > struct gpio_chip *chip = irq_data_get_irq_chip_data(d); > int ret; > > - ret = pm_runtime_get_sync(chip->parent); > + ret = pm_runtime_resume_and_get(chip->parent); > if (ret < 0) > return ret; > > @@ -942,7 +942,7 @@ static int zynq_gpio_probe(struct platform_device *pdev) > > pm_runtime_set_active(&pdev->dev); > pm_runtime_enable(&pdev->dev); > - ret = pm_runtime_get_sync(&pdev->dev); > + ret = pm_runtime_resume_and_get(&pdev->dev); > if (ret < 0) > goto err_pm_dis; > > -- > 2.23.0 > Applied, thanks! Bartosz