Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9192161pxu; Mon, 28 Dec 2020 08:54:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJzDOI107Ho5I9Bf5eYMsj4k5Ju8sVMA6da+x6IUP8l/fB9jyas1gUgHIoG/BD7ZX1fTJaUk X-Received: by 2002:a17:906:c00c:: with SMTP id e12mr31840166ejz.103.1609174472095; Mon, 28 Dec 2020 08:54:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609174472; cv=none; d=google.com; s=arc-20160816; b=YJwYfukGCRXbrIsraQTmVXJfs7wW07FN34E8XMnvI9wUmcT8+K4Q9K/m2m7cIJbt2N nJDeUXo7mGQHgir04I1o79l7VKfAjkyRfJgl+R1jGS65cPcu2wGSyjI5jvB5rnN9MHfx MaVaas0zb0lP0aME1VddeOKWXhsER81ZM3oty/MVuc7P7jS7vfdodW39z4FCc+QxFHT7 Yy6uQCtzn+W9/GtUrg+LX9ktSrXZcaF6q4iHlY0Kd2uTwYVAoSMc7AXt7is7A/cgO9oJ OnJWGrQbHP6v95Sf+1xK0ENMrskZqobZD6K+qB7iCA99IndCOt8maQiWzhksjSAZp7F7 Evrg== 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=E8tmSLf+vUqhNi5GcMcZNlxO8GAbkZmSSwUNIlRjdtE=; b=yvRQhOz82zqokXjoL573co3e+PLEqXvswsegol3J35vJnsPTbuTinKLGoavJRnNSZZ adT0PmW1nUHkPxCZbvRqoCkWXZoeKnU9vlX8EzmO3k1oMrPqFtpwccI+4xpskEv38wME /nDecFIisUg86PmqNuXZ2949+QKSRysCHgVE1y5laaOdnfkbuZ8GwvPI0Ve/VoKd9Y0M GT6piSAwSkv4kx0UDW8p2h9cIiOAUaYWovT0FDQLgPRkjhstMsuNYxFY1WWhfKUIPH7T H0jC8lyKljB9D9X4+V7i6vAZk/5nSfnMVXeOv/Tlw9L3lpFwblFeDLJYFMyIvBbkkW1+ iakA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="vJ/5kxis"; 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 v1si21885152edl.62.2020.12.28.08.54.09; Mon, 28 Dec 2020 08:54:32 -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="vJ/5kxis"; 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 S1728154AbgL1QtA (ORCPT + 99 others); Mon, 28 Dec 2020 11:49:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:49818 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728094AbgL1MxL (ORCPT ); Mon, 28 Dec 2020 07:53:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 742CF22BEA; Mon, 28 Dec 2020 12:52:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609159967; bh=9yUyVpWtHmtbW8ffzytxnswISzXu3eLT8hYgQKmS3ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vJ/5kxis6UKiBJobz5bOPRWfc8CMrbbagyZvUhfVl5H7x8L+WnTkf7xSQX9wgkMjL ftwGb3GhqRjf0JZhggW2K6BwE6AaVG02bBS4BatIbA4YWwP3rOvkFLx0q7QW1cB1+F yDndXFcV8vMySgh9iF5ItF2KHE7i97EosEviDq5w= 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.4 038/132] spi: spi-ti-qspi: fix reference leak in ti_qspi_setup Date: Mon, 28 Dec 2020 13:48:42 +0100 Message-Id: <20201228124848.249320651@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124846.409999325@linuxfoundation.org> References: <20201228124846.409999325@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 45c0cba753641e5d7c3207f04241bd0e7a021698 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in ti_qspi_setup, so we should fix it. Fixes: 505a14954e2d7 ("spi/qspi: Add qspi flash controller") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201103140947.3815-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-ti-qspi.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-ti-qspi.c b/drivers/spi/spi-ti-qspi.c index 5044c61983324..6e97f71a8cea3 100644 --- a/drivers/spi/spi-ti-qspi.c +++ b/drivers/spi/spi-ti-qspi.c @@ -159,6 +159,7 @@ static int ti_qspi_setup(struct spi_device *spi) ret = pm_runtime_get_sync(qspi->dev); if (ret < 0) { + pm_runtime_put_noidle(qspi->dev); dev_err(qspi->dev, "pm_runtime_get_sync() failed\n"); return ret; } -- 2.27.0