Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9182111pxu; Mon, 28 Dec 2020 08:37:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8loZF1dAeNMs8DpsC993fVAMsA177o+JI6od2PqtS+BdMNnWXXGFF0W/8otwXPW8SJbgD X-Received: by 2002:a17:906:a00a:: with SMTP id p10mr43003907ejy.312.1609173450032; Mon, 28 Dec 2020 08:37:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609173450; cv=none; d=google.com; s=arc-20160816; b=Q0zzLu+PLNTJaN8jgU4B2Fd1mNAajf1BEHlGzwFdxMnRAxfnus1KaoApJGE3FQLNJ8 fNdqtoWX216DoaFh8jyQDB/wgxNROYBqQM/Wi46aUB8NGVY3BuE7yYaItfW7bbVmzQel XCac+qIi2cepgqL0LKDrhw+dBrVEf159apFoL0vbwxbonmx8qthHCCNEwOeYnSiTEBzT SZGodRj+o8Zw1QBsk3aH1GTRSMjTDYjHIRpdt/K2//66/q/8TcHDw0mFkmAo6X39HvsI +aYbiiuLKOCQ30V2CUs+ibRratXT0WnIskBLba0N9sjPnXnwDUCmyXVH21RbM6GWzTUs oWog== 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=jIRpu9ocaQ7FssU31p4R9ztTVYUx+l/rmP+2ticv6AA=; b=AcBS6VRSsax47PsyvZ0lRzrkgPG5DbwANfFpCq9uXB/T8HaZogKrxwMDJxz67u44o0 CsHdBYYYi51iJT8RdoxW1fwV5BzOrveLzu/iYRaLBDhiCkKdMMqM1g3IGl9+t4wbBXol inWt5ChWcpFLe9H24eGE73y4oaf+xQW6bZAysrdd26+CVcEg3WZ/NtXU7W+b41KPxTMj UKZp7VF1ZypE8OhPpy1WV7yozVctHPcnko9t/Ksi+Nb+FZoOVuQSvva3KsNAappgx5iz Cs4zq+TJDczpx0O+XyJlG2ozXQiwkOSDuwLoyrmgKcullOiR71xsiChZHxjCU5+g1YO0 ju/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=BTJU+los; 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 e26si17802101ejc.540.2020.12.28.08.37.06; Mon, 28 Dec 2020 08:37:30 -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=BTJU+los; 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 S1729232AbgL1NDU (ORCPT + 99 others); Mon, 28 Dec 2020 08:03:20 -0500 Received: from mail.kernel.org ([198.145.29.99]:59306 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730181AbgL1NDK (ORCPT ); Mon, 28 Dec 2020 08:03:10 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 0A10521D94; Mon, 28 Dec 2020 13:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609160549; bh=1+WJhuqiIlTTxLU1mPqvf7iqnbTrIvjkKpOo/HKNRYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BTJU+losxFXoo9liEB/gW+8LEvjfM+QqEemQdJr1EBYkTLNe+FwDatOLV9SlOykh8 k1ZSf9iu/mZj0eXO5Jjj1LPdnCF+aX35iAu9FpY4sjHd9r10fmNbdGZTMCjFEStZ/8 EA0Wr0JveXhn2n9TWpaHa4+9L9XDG6YfXzUgogf0= 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.9 059/175] spi: tegra20-slink: fix reference leak in slink ops of tegra20 Date: Mon, 28 Dec 2020 13:48:32 +0100 Message-Id: <20201228124856.124831727@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124853.216621466@linuxfoundation.org> References: <20201228124853.216621466@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 cf2a329fd8958..9f14560686b68 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