From patchwork Sat Jun 13 20:44:19 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wu000273@umn.edu X-Patchwork-Id: 11603807 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7798F913 for ; Mon, 15 Jun 2020 06:27:54 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0D5C220776 for ; Mon, 15 Jun 2020 06:27:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YWusdoTX"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=umn.edu header.i=@umn.edu header.b="bOdSaBZJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0D5C220776 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=umn.edu Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 827EF1674; Mon, 15 Jun 2020 08:27:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 827EF1674 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1592202472; bh=lWj6OROVeKEZk09wCHJnuP62vbUo6KyU9qMQKdtmGuo=; h=From:To:Subject:Date:Cc:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=YWusdoTXmFK5aPXJ1P8E/x2ak/71r6oF3PPly9psF2W1+zDim8ITMAF1BCUPFwW7I CBrVrwbUZ7HdpL/mdsxZKv3d09YxZfpHadhxoAu5xaok9c6edJxLz9/zKwUECQkh0K 5Q7BDhSM39NeRDmSiSuV+UBV3VqHe9mrmFBbJIOg= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 3264FF801ED; Mon, 15 Jun 2020 08:26:13 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id 43B6DF80279; Sat, 13 Jun 2020 22:44:41 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from mta-p8.oit.umn.edu (mta-p8.oit.umn.edu [134.84.196.208]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C4538F800CD for ; Sat, 13 Jun 2020 22:44:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C4538F800CD Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=umn.edu header.i=@umn.edu header.b="bOdSaBZJ" Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 49kqMf6zTwz9vC9N for ; Sat, 13 Jun 2020 20:44:30 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id E9Wf4i3Pi3CH for ; Sat, 13 Jun 2020 15:44:30 -0500 (CDT) Received: from mail-il1-f198.google.com (mail-il1-f198.google.com [209.85.166.198]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 49kqMf5HDDz9vBtg for ; Sat, 13 Jun 2020 15:44:30 -0500 (CDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mta-p8.oit.umn.edu 49kqMf5HDDz9vBtg DKIM-Filter: OpenDKIM Filter v2.11.0 mta-p8.oit.umn.edu 49kqMf5HDDz9vBtg Received: by mail-il1-f198.google.com with SMTP id s4so9122174ilc.7 for ; Sat, 13 Jun 2020 13:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=b+iEIISmV4Ee/AXAA3HOB7wr+a6MNiCQ3dfMd9OfhgA=; b=bOdSaBZJyTwhn3YzlHvp7XflMqAXEC1LpqwMml0xxBo5lSuHSEclQyM/T+uTA3IZzc HEO/kBe9rFXMiKJRk3a8ITNQhwu+BCUnLYS+hBSKoK8Ku25nLty0vAuqscqrUK76nYvV TuYLPgp7WsAg5VrDyySlBlUZzgOt8QDJLcJJ0xqXFrTUQzlLDWOt80HDhJRJaJ1BOeH6 AhJl+Hl4QQQV2/JQZWVLX2BVdaba0VD3zbvqjFDl1Xkdwc0JL713elOt7Gvu3nrdWcCQ bReuBufMwdFIEVOhMswp6HS4S/OL/jnNj5MuyrwVJ9/g1IzBA/sxtlaCU+At7lFPgC4T PGUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=b+iEIISmV4Ee/AXAA3HOB7wr+a6MNiCQ3dfMd9OfhgA=; b=mFhDpksS5AKwZF4DysgzsDw5O3SCZvucw+chtwMyPNL6x4gS/H2JR/d+7b2LWewyAV tDp7fVh7u3/6up5gTbreLfaO3MHalIoPVPYFlh9BQeI3QQZ5fzUgyxbNbVZPKh7gzWyo 6/jpZGBptL+YT9/9EHnp+v1KwdGfwdpiPVoPo7HEs7byKcj3xUBbGnbzYrC8a9du/jd+ J+fbeI6AyJvbHWhEBKuFUxQ91knf7WT94zw+HXUrokP4VjDSweLX7TYPSz9zAGZz9MON b1qWhDXCkHZ9vlSz/xA7rgrGwhvuoLZLcUFVEU/J4o8SGxVwsY2kAgyZF4iEpDtAQj57 rjdw== X-Gm-Message-State: AOAM532/lPX54KphY5SWgUyVDZcSnkl9gh0h7lPze7yeBDjdbVWKil6V saAl2bKXm+39WeODSJEV0LuZQtAvWCTw1a1GfPaWxKipxi2VS7jpzrlheE/4jPD2mTTmtl1lhJi nyBguZprSFADDSk5h1heDX59O9os= X-Received: by 2002:a05:6602:491:: with SMTP id y17mr20185655iov.72.1592081069821; Sat, 13 Jun 2020 13:44:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzuUH0JGzr6A1aKGQO/t0YzwjO1OxoyYGiXTl5u65tMnE63FPrdxzR6es2yGQb9rtR6FHN2PQ== X-Received: by 2002:a05:6602:491:: with SMTP id y17mr20185631iov.72.1592081069282; Sat, 13 Jun 2020 13:44:29 -0700 (PDT) Received: from qiushi.cs.umn.edu ([2607:ea00:101:3c74:4874:45:bcb4:df60]) by smtp.gmail.com with ESMTPSA id t14sm5083251ilp.73.2020.06.13.13.44.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 13:44:28 -0700 (PDT) From: wu000273@umn.edu To: kjlu@umn.edu Subject: [PATCH] ASoC: tegra: Fix reference count leaks. Date: Sat, 13 Jun 2020 15:44:19 -0500 Message-Id: <20200613204422.24484-1-wu000273@umn.edu> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Mon, 15 Jun 2020 08:26:10 +0200 Cc: Jonathan Hunter , alsa-devel@alsa-project.org, Edward Cragg , linux-kernel@vger.kernel.org, YueHaibing , Takashi Iwai , Liam Girdwood , Mark Brown , Thierry Reding , wu000273@umn.edu, linux-tegra@vger.kernel.org, Ben Dooks X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" 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. Signed-off-by: Qiushi Wu Reviewed-by: Jon Hunter --- sound/soc/tegra/tegra30_ahub.c | 4 +++- sound/soc/tegra/tegra30_i2s.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c index 635eacbd28d4..156e3b9d613c 100644 --- a/sound/soc/tegra/tegra30_ahub.c +++ b/sound/soc/tegra/tegra30_ahub.c @@ -643,8 +643,10 @@ static int tegra30_ahub_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(ahub->regmap_ahub); ret |= regcache_sync(ahub->regmap_apbif); pm_runtime_put(dev); diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c index d59882ec48f1..db5a8587bfa4 100644 --- a/sound/soc/tegra/tegra30_i2s.c +++ b/sound/soc/tegra/tegra30_i2s.c @@ -567,8 +567,10 @@ static int tegra30_i2s_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(i2s->regmap); pm_runtime_put(dev);