Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp573771ybt; Sat, 13 Jun 2020 13:54:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzozfGfpdhJEzTMT3tQTI04KJAuN5cUbskQriRNP8niw9qpFP8B6Tu8cQgaXT1PmiaaF3xk X-Received: by 2002:a05:6402:307c:: with SMTP id bs28mr18484710edb.3.1592081671352; Sat, 13 Jun 2020 13:54:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592081671; cv=none; d=google.com; s=arc-20160816; b=a6ggMKnOapcJpl/BycdTcXaZvgSJIp+XzJk4+WBI6Zbp0ua4HogNgz6d5gbZE/ubia anNQWi6mWoPo5aUf96yHE1QCYwXWT91Vp2/mKeBT7eBufAJrYxt47KSe3fiec4IPZ/Zx 1NbYRybEShRNtKXZxH2Txme31xllHnExM635YwC4lJKs+uryu/urKL8+/OUePiKaw4q4 aK+0Y8Oz8rVuUAeo9GKwq1lotMM+lBFM95uIpf7Rh8SUZzdKpqbBXVlRwSzjZ5IgEi+g plVlGKMP+fCJoEA55kPrQ1mCSfTyp5L3EmprT0OM8nay7oTEU9vmqbc73WODcnHNM4TM T6Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter:dmarc-filter; bh=UkcroixAl0qAjD6GgNgyzou/IsN1STk9p+xVVDcmeP0=; b=e8QNWvpmf2R5m4ab5uzYRVFWUiTUg9VY/fWRATiUzmXBmgu6FN9q+nefwV9ArDpSMa GNnTmnPzTdrrklVDLwftQNmSBjmKatQgkF051Ci+o166FAzXaf2hjkrTFDINsIosTXlO VvKdpgx2i/MJFC+wz19NNDlGdCZ9G/I9ucg1mv5bv+mxUozNvuAfMx40w9dKZCfUkm6f Urubpwl372/D90j7iK7dwTCVlE6WOfWxCbN/v5dL/O1BiZ3u6WE52WHKtYV1dTQ1B4fm l0X3Lb5nmj3J8xHunAN2WNFZtSa/pPmC4hpoN7xEF0HsXhDA9hpHAbdK8aE6nXmdCeZc Xk1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=Ardg8aLx; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z28si6270408edi.287.2020.06.13.13.54.08; Sat, 13 Jun 2020 13:54:31 -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; dkim=pass header.i=@umn.edu header.s=google header.b=Ardg8aLx; 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; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726631AbgFMUwK (ORCPT + 99 others); Sat, 13 Jun 2020 16:52:10 -0400 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:44878 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726092AbgFMUwI (ORCPT ); Sat, 13 Jun 2020 16:52:08 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 49kqXR11gHz9vZTv for ; Sat, 13 Jun 2020 20:52:07 +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 V-LTL5QAY37K for ; Sat, 13 Jun 2020 15:52:07 -0500 (CDT) Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) (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 49kqXQ6JvXz9vZTh for ; Sat, 13 Jun 2020 15:52:06 -0500 (CDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mta-p8.oit.umn.edu 49kqXQ6JvXz9vZTh DKIM-Filter: OpenDKIM Filter v2.11.0 mta-p8.oit.umn.edu 49kqXQ6JvXz9vZTh Received: by mail-io1-f69.google.com with SMTP id x2so3177452iof.0 for ; Sat, 13 Jun 2020 13:52:06 -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=UkcroixAl0qAjD6GgNgyzou/IsN1STk9p+xVVDcmeP0=; b=Ardg8aLxFj2jA4QjL4csIbDmbF7Qv6ioBUq9BFwPAzpqdsP+ivgI2B8v6vEDSmF5Kq T+VI+cMiJyrltzxL2KJ+S2WHTXIUF/tzDx+Hy6iiCbHiebDtommqrsorIxWsJtD5Xxfl rSzCIoMmPWNRk35WVAw7LbUcN+FwnWoL2ov7l39z+On9rB0EWpXx0pMhwvIoyqrXUaxN SVjXxR5F+7oT+/CflVUIQ8BF6ijShRJTLfKceESF3Hx+zZ8lX0oXaFdA9bCViMHOZw8e x1Ek4ACuuHNQSXcdq2kYUQsZrqkPdIsjq0SIXmIxXnf4IToCmyoJ83/4UJ3PDAddESUD Xw8w== 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=UkcroixAl0qAjD6GgNgyzou/IsN1STk9p+xVVDcmeP0=; b=hI/JvNJzO/U1faBCyzUO4I18vMWdCQaduhz7w+pTznFvNTdpKv/wS8j5rivllEUtpV NN/uNejSN0Wfvv/yVWrRDJqTSbt7kNZYGxXijMSiLzNzFx7wH8nEJkxF+BoSjTis7N9r fO9yRqjswxGB9qHr3hyWDdLrpqdjx4h+rk3bF5pRYyqMuLUNCGPMli6vD21pP6jVM+w7 g+2Es2K+0jP8+OTJYC5d7WC56Rb4lYygVVfP/MQxh5j7LggQjO6Wyn86/6t3fjrzkCc8 tlPvnWYg5IN/GjgIHnSaFRdnuI8V8tp6MlGxvLqjrqQqWS3Ut2K9Ia72nx9lotvdr4Mc RxCQ== X-Gm-Message-State: AOAM532auQ5JLyqWOzZaYKndkLFZBoReMTxnO8lRsLDYnQ77Jsvki0qA bJWTt8egIQtMu0ohCX6i+Oo4jqaEfkW2ABqpvcTn1PT+CDsG9PG1eS/il5RIgphOc80BacyO6Wn MaftXlNbmqYBolW4irlzq+dL420o5 X-Received: by 2002:a05:6e02:542:: with SMTP id i2mr19700878ils.203.1592081526450; Sat, 13 Jun 2020 13:52:06 -0700 (PDT) X-Received: by 2002:a05:6e02:542:: with SMTP id i2mr19700858ils.203.1592081526162; Sat, 13 Jun 2020 13:52:06 -0700 (PDT) Received: from qiushi.cs.umn.edu ([2607:ea00:101:3c74:4874:45:bcb4:df60]) by smtp.gmail.com with ESMTPSA id c1sm5138369ilh.35.2020.06.13.13.52.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 13 Jun 2020 13:52:05 -0700 (PDT) From: wu000273@umn.edu To: kjlu@umn.edu Cc: wu000273@umn.edu, Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Heiko Stuebner , Sugar Zhang , alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] ASoC: rockchip: Fix a reference count leak. Date: Sat, 13 Jun 2020 15:51:58 -0500 Message-Id: <20200613205158.27296-1-wu000273@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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); -- 2.17.1