Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9394639pxu; Mon, 28 Dec 2020 15:04:42 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUacA/mTNSfj1b/WF7R0d63y3hTQoJ6W2pkUdjM6cGu9mDzwDz0/Mw3GBsBt8EOkKTxPVb X-Received: by 2002:a17:906:22c7:: with SMTP id q7mr43313432eja.486.1609196681898; Mon, 28 Dec 2020 15:04:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609196681; cv=none; d=google.com; s=arc-20160816; b=ctg882Z7NMIO0wglJRxRRhGwBpCfp/l4CmuHdNKEkqHn2xfGczYREM+7jjOElkYpqo +mmhpKrRTBO5Ohd6vFS/BHUDyNWaVMmpTYbX7Mbkec8vzW/BWlsvobz0sWjXPdHPLjNw I2P2ng7Dgzs9zPUXJFasMv/x9ft4A96A+xYem4YOkSFTqrW0cFmX9Z72cKmrY9LdzKmH 7a2gR1YEzA2WubycVZh9AnZbjptPGGvtkANt+vfb+TCLoIspu2tYEfkm9/bUgLkB+oBA 2gWZouI2mUE2QIftDlDxqaciKmLrWAEHzq9uCqm20j768OnYrLlfIOUWrO8y0ca+Mb9N XJlg== 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=pE67cY5nHlazjupAgBgKtj+vZtBJ/hu4LcJWO4UVVQw=; b=S5kD1Xv1aOZ2LIKrtYJ5WvFQNIjFrvkM//9/KZ7X41/Iu+Qk7mX6SbKiMDrocvP1Er CwCBEklitT9liybdMhOC/0hxQrAlaPWn2aLVyBanX/16GUfDyE2MgtDxxLlJ0FILOfHh AQK5lKQi5o/WqQNmAQ3/g1rJAuEbxF2Earxa3s5EmS6VqJI+SoT0qPO6k+zxdw8YoF1O 2trBOJz/Jp16xswk9Otts1MEHcN+EHfpXqZ1am2ZWlg0V8C53zEDxSCfDW+/D/cUp0Xf Bqga92/K7nck2DkHIImHCXpRTefkrnr2Lc+CuD/vjWCwkdrdj6gpjBVjRYauAVoBBwQJ tHyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OoTg47Wi; 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 r16si1596546eja.339.2020.12.28.15.04.19; Mon, 28 Dec 2020 15:04:41 -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=OoTg47Wi; 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 S1729502AbgL1OE1 (ORCPT + 99 others); Mon, 28 Dec 2020 09:04:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:38734 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2437349AbgL1OE0 (ORCPT ); Mon, 28 Dec 2020 09:04:26 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id AFD2F205CB; Mon, 28 Dec 2020 14:03:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609164226; bh=DwjKYSdCdXLNQ4MAbFarS4plnVMXTaX54jA/H30xUyE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OoTg47WiD0YwemZIAMN/YTlmaqJtY4BkJCjSMRfZrSYXbCmXjqxYRyHbL/LCVgLwS hN7YERzlb/imsUiqCZK66kpEGUndAbf14weriZLvM5Ah50Funbk+wbi0r78lovz5KK ZfL2EMcBF5kAhhTTYN1xdH3gqD1isM01L/z9vphk= 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 5.10 078/717] spi: tegra20-slink: fix reference leak in slink ops of tegra20 Date: Mon, 28 Dec 2020 13:41:16 +0100 Message-Id: <20201228125024.724689207@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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 a0810765d4e52..f7c832fd40036 100644 --- a/drivers/spi/spi-tegra20-slink.c +++ b/drivers/spi/spi-tegra20-slink.c @@ -751,6 +751,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; } @@ -1188,6 +1189,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