Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9265894pxu; Mon, 28 Dec 2020 10:51:32 -0800 (PST) X-Google-Smtp-Source: ABdhPJxGZSAMSbus6jnnVVfwMuOk+UDojYm3k1cX2nEQtVA6d0vkjlCoJqg2bPAefJSqsHVfjj9k X-Received: by 2002:aa7:da8f:: with SMTP id q15mr43080838eds.239.1609181491832; Mon, 28 Dec 2020 10:51:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609181491; cv=none; d=google.com; s=arc-20160816; b=QuzKBGJJy/x+9CBJ4Noc/vPIxzr4zXA3r54AljznkWaQZCctpU8CBlvz67Zmz5v28O m+q4cBk2BJMcxNqnRlUsU3R8VdCgdg99FE5nK4vIIVPZbji/BsdnWYwPLzftR/ncLP1S 0QPpzQXO69+UNjFYXcVjx8SesGIRfLFDbD/dQdpiy6dOZrwFarU6O/GQMjxM9+LxxgHB 5+OaS5ofKgic34G74vjcDP3LVs7UmkcuiGLSym1Q7r3oagJ6QCO6Dj2uLVQ4you484RK mjzgOpkMoOy5cMlTW9CYfz1OXLXsa5FfoahqfUNIqTAkdK9+sgz+T2AE+TAszfmQB3Bo TWxw== 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=Oyi0MMMBAOl4kbyWsK14drbRk+muNBoSr9IGQPrmfnI=; b=cjcX5EZOzMly+X0MQqrNy5cmXmrZ5KXE5oCYBeS/ENOtOI2nDnoRB3WUkAs816RXy/ kjPlExvjelicChgGQV3rpo7XMuQ4NKVEHPnfyTlawMsouDlGpJ92qmNLVJKCo3F8CLj3 DsP2Kn4BxaDa6sVX1f8kUW5H5upRSPR4yLoerKM1yGlEzy2EzIRiCFR7IC+r+B4RGfez pv9LLl5KfwORq1o8dl+sJ9/MKct6PUk9vuU33ZgqUovgVD1Ce7tKYOmbiigMbJkyo4I+ B199HOm0ksxGQKKoH8r+HwsCFKiQ6L0/xVAs15XzmxHTQmlUI+7EE+9UOyWDOfC2svKn midQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="UFJQrAE/"; 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 y22si20699269ejc.25.2020.12.28.10.51.10; Mon, 28 Dec 2020 10:51:31 -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="UFJQrAE/"; 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 S2391966AbgL1NoN (ORCPT + 99 others); Mon, 28 Dec 2020 08:44:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:43938 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404468AbgL1Nn3 (ORCPT ); Mon, 28 Dec 2020 08:43:29 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 22A032063A; Mon, 28 Dec 2020 13:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609162968; bh=vjpw8D6rG4KQXy7E3X/s0OW6bMv5lYfdlyFwqJ07DlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=UFJQrAE/RP6psYI4FuTnvTCqcHLSWclfPxBR1NuuydFWr+qPEOiabw9yie1Wu+V56 8Jq6zRnhFs6d8jzVqWW8f/VO8ri4VXGG2rrifS8Aw2zh4LsWDZtQFAQpSfKHeP1pL6 IVICoWvuQq6RFQXe2u9X/VN6ELCZPD4Ui4YCPLP4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Zhang Qilong , Chunyan Zhang , Mark Brown , Sasha Levin Subject: [PATCH 5.4 123/453] spi: sprd: fix reference leak in sprd_spi_remove Date: Mon, 28 Dec 2020 13:45:59 +0100 Message-Id: <20201228124943.135215333@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228124937.240114599@linuxfoundation.org> References: <20201228124937.240114599@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 e4062765bc2a41e025e29dd56bad798505036427 ] pm_runtime_get_sync will increment pm usage counter even it failed. Forgetting to pm_runtime_put_noidle will result in reference leak in sprd_spi_remove, so we should fix it. Fixes: e7d973a31c24b ("spi: sprd: Add SPI driver for Spreadtrum SC9860") Signed-off-by: Zhang Qilong Acked-by: Chunyan Zhang Link: https://lore.kernel.org/r/20201106015035.139574-1-zhangqilong3@huawei.com Signed-off-by: Mark Brown Signed-off-by: Sasha Levin --- drivers/spi/spi-sprd.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/spi/spi-sprd.c b/drivers/spi/spi-sprd.c index e60aff9903951..c2bdf19ccdd26 100644 --- a/drivers/spi/spi-sprd.c +++ b/drivers/spi/spi-sprd.c @@ -1008,6 +1008,7 @@ static int sprd_spi_remove(struct platform_device *pdev) ret = pm_runtime_get_sync(ss->dev); if (ret < 0) { + pm_runtime_put_noidle(ss->dev); dev_err(ss->dev, "failed to resume SPI controller\n"); return ret; } -- 2.27.0