Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1299306ybt; Thu, 18 Jun 2020 05:35:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzYWlFsrkjIecD+wn60E/NQWXyBMKeoM/PW6F0M0l9axZ+dwIXYRG2MirPXbElXsxzSH0hs X-Received: by 2002:a17:906:7751:: with SMTP id o17mr3911773ejn.111.1592483701094; Thu, 18 Jun 2020 05:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592483701; cv=none; d=google.com; s=arc-20160816; b=vh8QDBXxpjiTChB9c7jVKCRj9IawqGxkq3X+40or5Oki+yqBzSSwWhJ7xXyxsatdGi Aofm9aasn9bA+1tJO3g85r0nc3uYSPMJh7+emODMg6zjde+AT3g2mXTPJEhymS9qWoa4 zbugt+4zkfxcGViJEk1CeAwwGIe+1F1w2P80HLtIW2R9Dn9c1trzOQ041wjFSeXfdFny kUbot0poshmgrvqfg3rb4iIOlwaHQd7NDrqofWe5a154aQK53yxWBkHeF/nWGC7A0TcE Cp6ZGoBOqwhNr22sl9OJ9zOzG0cMQi7YwVB9mD+o395jqkZvz2HMeWaVjadixf7iMTQT FVRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=rPYxHfJS+cNr3teRBnvBKqduel84WFSzt6CjYF9U7/g=; b=epX6sqDMubBl4IlB1mbm7hn1nOVSyrsVg1dtHBHu8T248voCiPrcuKeeRBukUTqWQj KJVGg+uwcVPJ8DFbkwLkNA8TNvFiY5+dvgfKimuR1pwQ1kJAK1rveVYEq3YtTCf4lvKP A8vQSnXDahD3F0Z08PStCemI8hlKrW28S7k2f2pPaDr8xK50IIgEk/yFAhwqqkK9GNfD APE9sjenTDMX2E8DJbjU7p6Nkp8N2waMW44WNf49NmBPT4vdypTH7YoxomRoHo4UijER MGGm9EmovrBhk7pPo12hYzx3r8wa1tjG/lS7tQoRIWZlxgf88yq1psdtSXDTDFktNwG3 NA6g== 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 dn17si2573611ejc.556.2020.06.18.05.34.38; Thu, 18 Jun 2020 05:35:01 -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 S1729026AbgFRMcp (ORCPT + 99 others); Thu, 18 Jun 2020 08:32:45 -0400 Received: from gloria.sntech.de ([185.11.138.130]:53660 "EHLO gloria.sntech.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727793AbgFRMco (ORCPT ); Thu, 18 Jun 2020 08:32:44 -0400 Received: from ip5f5aa64a.dynamic.kabel-deutschland.de ([95.90.166.74] helo=diego.localnet) by gloria.sntech.de with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jltiJ-00082t-U1; Thu, 18 Jun 2020 14:32:15 +0200 From: Heiko =?ISO-8859-1?Q?St=FCbner?= To: wu000273@umn.edu Cc: kjlu@umn.edu, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Sugar Zhang , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] ASoC: rockchip: Fix a reference count leak. Date: Thu, 18 Jun 2020 14:32:15 +0200 Message-ID: <3050852.oyibrqGndV@diego> In-Reply-To: <20200613205158.27296-1-wu000273@umn.edu> References: <20200613205158.27296-1-wu000273@umn.edu> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am Samstag, 13. Juni 2020, 22:51:58 CEST schrieb wu000273@umn.edu: > From: Qiushi Wu > > Calling pm_runtime_get_sync increments the counter even in case of > failure, causing incorrect ref count if pm_runtime_put is not called in > error handling paths. Call pm_runtime_put if pm_runtime_get_sync fails. > > Fixes: fc05a5b22253 ("ASoC: rockchip: add support for pdm controller") > Signed-off-by: Qiushi Wu somewhat unintuitive, but I checked __pm_runtime_resume for it, so Reviewed-by: Heiko Stuebner > --- > sound/soc/rockchip/rockchip_pdm.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c > index 7cd42fcfcf38..1707414cfa92 100644 > --- a/sound/soc/rockchip/rockchip_pdm.c > +++ b/sound/soc/rockchip/rockchip_pdm.c > @@ -590,8 +590,10 @@ static int rockchip_pdm_resume(struct device *dev) > int ret; > > ret = pm_runtime_get_sync(dev); > - if (ret < 0) > + if (ret < 0) { > + pm_runtime_put(dev); > return ret; > + } > > ret = regcache_sync(pdm->regmap); > >