Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9175458pxu; Mon, 28 Dec 2020 08:27:09 -0800 (PST) X-Google-Smtp-Source: ABdhPJwHKamXKufJOL+iEMLUoXyhRjHZlGPWydNpWM1aBI9EnnjCP/iUCSGBMxAT3972UaaXBgSW X-Received: by 2002:a17:906:3d62:: with SMTP id r2mr43330602ejf.295.1609172829776; Mon, 28 Dec 2020 08:27:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172829; cv=none; d=google.com; s=arc-20160816; b=FP4mlJ4MyU32Ck0qnb00NbXZd0kvp7jCqc/uydhe42GGizAL/wYQYuzSUejvuoTUcF QwpVbV2H4IyhtkdxACxG0KJsuh5VAF2h/I5RzpbN+Vt4k3wQXnrztAmznz29BbXC6V/h up51Z1n1Dt2DPCowiycSRF+cjqkmoCCx+pPYwvCniPUcTub5vpWy1drPNSyRSCG/2W/i 8G3PowmUX9ATlsMPmDY8IxFrPtIIK4v4dWdHgJw01HXmxnLl9gTuQjccawrqwvu35pYU GaMdyZhYm2pv8npuaf5hnjFwqv1ZupF5aBTt2gz5vcmvyFP22Vv2n64jrlmA8e5uR+zh fMyw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=oE5bzXqXHHmg6JfYG5ZFz46ISyDjvzDnVu/pVtMqVTo=; b=Osrey/I4oLh/JP8be/pQoyiN8+v/KL7JRART7m8i3rDkxI6kW/8JzOJ+Q3nI6hYxZx tOhP3ktKKRXPh3KadZrNMOhwcK0nIwT3uQzywADXZXgWXyfE8PcW34DIECXgYXZ+br3S i9x69te9UDD70jA+H1+Sv3JjnhG6apDBizidF6VM+Mpcq4AokaTGaHpUtFlmzMY35/up ibE/MKlV/pURNTcd6gaupL53J0wlR+MdZKOPn0GwOT6tuYgqG9ZegcvykhJlXGS6qshq DG7hV6XlVQD0rG3ZqA+2yvvFY2+CD3dAyAlPs+KcbqXPRSipj5VxnHz+CLYGBlGU2BSu VyPg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RPePh9v9; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a29si21744056edm.401.2020.12.28.08.26.46; Mon, 28 Dec 2020 08:27:09 -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=@linuxfoundation.org header.s=korg header.b=RPePh9v9; 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=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2633339AbgL1QYL (ORCPT + 99 others); Mon, 28 Dec 2020 11:24:11 -0500 Received: from mail.kernel.org ([198.145.29.99]:39320 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731806AbgL1NLZ (ORCPT ); Mon, 28 Dec 2020 08:11:25 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 545E422582; Mon, 28 Dec 2020 13:10:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161044; bh=sZGKCIYyPzHBDLidcEsBcFCsUVUjCutr2XKDRYN9eJs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RPePh9v9jqpdkYKRyVUR9x+lcD63kxLzywG0VsWYC1l5fTzIDuEb2s1kpKhhCYvJ1 sEgcEkyxmNgXg4HTy5pBJjZSnk0VxfQ3nLI1Ffoy62fGjLomKRRtUZc+DQGdgf4Cmw Zb+lStHxmuRhlyh2ttW4EmRLguKYzAnw7trcYhF4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Mark Brown , Sasha Levin Subject: [PATCH 4.14 082/242] spi: tegra20-slink: fix reference leak in slink ops of tegra20 Date: Mon, 28 Dec 2020 13:48:07 +0100 Message-Id: <20201228124908.726949569@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124904.654293249@linuxfoundation.org> References: <20201228124904.654293249@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Zhang Qilong [ Upstream commit 763eab7074f6e71babd85d796156f05a675f9510 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in two callers(tegra_slink_setup and tegra_slink_resume), so we should fix it. Fixes: dc4dc36056392 ("spi: tegra: add spi driver for SLINK controller") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201103141345.6188-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra20-slink.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-tegra20-slink.c b/drivers/spi/spi-tegra20-slink.c index 62b074b167a9a..c39bfcbda5f2c 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -761,6 +761,7 @@ static int tegra_slink_setup(struct spi_device *spi) ret = pm_runtime_get_sync(tspi->dev); if (ret < 0) { + pm_runtime_put_noidle(tspi->dev); dev_err(tspi->dev, "pm runtime failed, e = %d\n", ret); return ret; } @@ -1197,6 +1198,7 @@ static int tegra_slink_resume(struct device *dev) ret = pm_runtime_get_sync(dev); if (ret < 0) { + pm_runtime_put_noidle(dev); dev_err(dev, "pm runtime failed, e = %d\n", ret); return ret; } -- 2.27.0