Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp4597693pxj; Wed, 12 May 2021 08:58:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEl3GB6qKgteK2lhzsTB80oAjzzQ3pVB9r9wzxZs3dF4GfISgloP2rkj9DMjRLV+5IuvOD X-Received: by 2002:a05:6830:20c6:: with SMTP id z6mr15495359otq.26.1620835091772; Wed, 12 May 2021 08:58:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620835091; cv=none; d=google.com; s=arc-20160816; b=gMX5xkPjBsqurAYNXzG8BJrs3ucklqC6NnCLpZ4hUGjVW5HUHZuLP/loTAg8xmsTKa KZo2uD2VjUpUgt2Y5GlwLn7peuV/pKVgalhxlAtaHmqI7iZeDs0sKh0QiW5YF7o13bhD SaNnEZ/Z8v5isRrBjVCeBlcl5RkGY/YcsNtGzTeZK2dBwuFlGS/ds4MHpIY82Q/oLxin wXDM3gGvG3gowBHtqOYt6SRA5HCtmCmM5QikVItgGW3Y9VrMA5uoSD+Kk8kq+H0pMH6w AFk5wazYi5TyU5HR2rtlgMo33lhbKIQbspisY6zu68IEQS6/5he3KKszdiEEKp4YS28N QQMg== 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=6gc3s2ZYM+mkmE/p1gPCN/43czItBHN6pnB5J8aNCfE=; b=UiDMq5+wwKPMpvPsK1b75bQsSt4JlgulNHYnyJtYJX26/feMHngE/b5TBBZFAmLZhF kGPJ0+mcufTbHIjHZHazGQonVMs5Kj8ts6Xapm2Pjgb6+gQgpGYGConnJMjf/W61Ot+O WQj/zrc8caKLXWw0AQFGoDtKLz9jU/gpi8N2Lhqi6fqfuHkhFU42FOg2Zp/Gjj20SCIG POdIy7wBJru10K2tYAvrzufNNlGYk5+HMN6PPGIolzvKrukBPN9A17r0mhm0DZPdJc0w vfrmLNL37DPGip6gyUPz2QLUS9+JtR38q1pK9S2Havr/Tg5Gem1sJ12hb3mLGfFNbJ5p R2EA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=DCUKfqwy; 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 p19si221611oto.21.2021.05.12.08.57.52; Wed, 12 May 2021 08:58:11 -0700 (PDT) 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=DCUKfqwy; 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 S237983AbhELP46 (ORCPT + 99 others); Wed, 12 May 2021 11:56:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:40900 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235299AbhELP1a (ORCPT ); Wed, 12 May 2021 11:27:30 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2995B61AC0; Wed, 12 May 2021 15:12:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620832344; bh=bME7cUGweBvzQ7c7y/JPK8QS7iBPZOIG/OEuLVjhu40=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DCUKfqwyIHNcXzoO/HdXNxB0pSTHpOS5Onh8YzN64+GwRcO+fcVV5FUsUkPOOzQjF wCPusjHIhxQWFeCs5dfujr1J74WslT4iZLc2dWm7ETMEwnZt2OKTavrpgAd+26WbFj 6xUM7ghtczmi/iVYNOcAkPNse+nx7ZGeAmWkjEJo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Wang Li , Mark Brown , Sasha Levin Subject: [PATCH 5.10 241/530] spi: fsl-lpspi: Fix PM reference leak in lpspi_prepare_xfer_hardware() Date: Wed, 12 May 2021 16:45:51 +0200 Message-Id: <20210512144827.761097770@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210512144819.664462530@linuxfoundation.org> References: <20210512144819.664462530@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: Wang Li [ Upstream commit a03675497970a93fcf25d81d9d92a59c2d7377a7 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to putting operation will result in reference leak here. Fix it by replacing it with pm_runtime_resume_and_get to keep usage counter balanced. Fixes: 944c01a889d9 ("spi: lpspi: enable runtime pm for lpspi") Reported-by: Hulk Robot Signed-off-by: Wang Li Link: https://lore.kernel.org/r/20210409095430.29868-1-wangli74@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-fsl-lpspi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/spi/spi-fsl-lpspi.c b/drivers/spi/spi-fsl-lpspi.c index a2886ee44e4c..5d98611dd999 100644 --- a/drivers/spi/spi-fsl-lpspi.c +++ b/drivers/spi/spi-fsl-lpspi.c @@ -200,7 +200,7 @@ static int lpspi_prepare_xfer_hardware(struct spi_controller *controller) spi_controller_get_devdata(controller); int ret; - ret = pm_runtime_get_sync(fsl_lpspi->dev); + ret = pm_runtime_resume_and_get(fsl_lpspi->dev); if (ret < 0) { dev_err(fsl_lpspi->dev, "failed to enable clock\n"); return ret; -- 2.30.2