Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9175377pxu; Mon, 28 Dec 2020 08:27:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxL9NlNnCQ4gaR9ZRT3w29H/gPlaIuAxeacn7vcVN9ssYupGfd3aLLGfm7Y6DI+ppY7m/eE X-Received: by 2002:a50:e848:: with SMTP id k8mr42673238edn.77.1609172822555; Mon, 28 Dec 2020 08:27:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609172822; cv=none; d=google.com; s=arc-20160816; b=A5fsh2AoU4FNDOi33tF0suzGW+DsthUUJpH5dwhLWaLt5aK/SwAoBGGTJEXIC9CnqX p+hauzo73VPYEwCqraFDMn4tqURmqJa/FO2vt5PfbtT4VqjzIq2AHzSm2YzfhXWgJboF Sui9+DR4r747pyRUcHI44Rvr0teA3+W440Y6ecMR8CFwZTutWFs4uU5TZjGSf+E8sr9L GQtPvrMAbNR6qP7YJQCGevOGfkoEPnabSCQwj6NOQPygIzV8g8zidZCOYEOjznAYrELm wFMoVnf28VfwGz3OqpihiPxaZTJjn+SVwItBwXSyoswgKVTzT4FTsHzDz844JA+ummAM LR6A== 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=o/NAE0jzF4pES3ZqIIoo/FwaGcGjy+P5Rmt0PAi7mXY=; b=QA2g1izsxHSbYKdiY6VSFMAMUJXCPkh0atyHaGURKFipeEktQl0k99wt1lcye76bTJ GlxQ7pJecoJDT8NQsoZDZZe7JeJYpHq5CnaDIX6L9zwGHtyim+gzEvuvE5Ou72yPF4+r SaQQpbvBuxJrw56psXPl8sdkOZRKyeOsPkhigzrxd/ihmbbfAyLWKw5DgXLyXsubsKiC ZJvrKbKG/qUrR/ol0ORcakdeVuuIulCRwxFb+2YrPh9oh7XECTCad4jdnrVzvj4TPGL0 uoyO6KYmhpvp0lXyB+Ovk8RVNYU4iSdxXkbK7vjbS3q0ZbDqQw3nJaY/OzNw69surjbA kGmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XJzlDSsx; 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 u13si20275479ejn.694.2020.12.28.08.26.39; Mon, 28 Dec 2020 08:27:02 -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=XJzlDSsx; 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 S1732435AbgL1QYE (ORCPT + 99 others); Mon, 28 Dec 2020 11:24:04 -0500 Received: from mail.kernel.org ([198.145.29.99]:39480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729477AbgL1NLb (ORCPT ); Mon, 28 Dec 2020 08:11:31 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id EE89121D94; Mon, 28 Dec 2020 13:10:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609161050; bh=6ioSoxzL/MJ97AYbqt/OQCyDR+3ndcO5HDNPaBTuN/g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJzlDSsxxhAahvRbIUGP5VW2wlObXxLf9felFqm6GziN/Qdvi8rJQcNIW0uXvqM+6 MnHj0KfKhbjrrovRzckjehNd9NGUApthz7fA8jGyhYoO8otBj+OWLVAVa0hISP4WKS tHOvzkDImus4gemBL1xqK0u6l0rmx+n1VEfVpuzg= 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 084/242] spi: tegra114: fix reference leak in tegra spi ops Date: Mon, 28 Dec 2020 13:48:09 +0100 Message-Id: <20201228124908.827096034@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 a042184c7fb99961ea083d4ec192614bec671969 ] 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_spi_setup and tegra_spi_resume), so we should fix it. Fixes: f333a331adfac ("spi/tegra114: add spi driver") Signed-off-by: Zhang Qilong Link: https://lore.kernel.org/r/20201103141306.5607-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-tegra114.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/spi/spi-tegra114.c b/drivers/spi/spi-tegra114.c index 84ff0c507f0b6..0e1a8d7aa3224 100644 --- a/drivers/spi/spi-tegra114.c +++ b/drivers/spi/spi-tegra114.c @@ -827,6 +827,7 @@ static int tegra_spi_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; } @@ -1252,6 +1253,7 @@ static int tegra_spi_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