From patchwork Tue Sep 3 00:43:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nathan Chancellor X-Patchwork-Id: 13787810 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 20D22C54FC6 for ; Tue, 3 Sep 2024 00:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Cc:To:Message-Id: Content-Transfer-Encoding:Content-Type:MIME-Version:Subject:Date:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=dvebBbK5HD67PDqNkfW6IOAx0ouh2WT0CAaLbHD/oek=; b=X7CXJEbllCcM87c6af7SjlXh5l GAomnmDe6fLjhKbQK/dg+Avr4AsC9lDn5oo54NZQ9aEPn064Jul0iTRMBT9bbmx/BbcTWa8teCSSv wWcX0nXQP8TIXV8fstY72dzjvKx0TIVm/6p7C3jThG4pcGRiGroETjfNN8etLVcji2ZRk7IY+gbxK Wb2EEiQ/oIiDu2rvxcXVKuVFX6SJzGd9lXO0RDaI0Q86aovtAWUsEkQNa30Zzyjxcv38AT6eQb5oy 55ElhV180w3U/pf5LpHT0BepjvHDSFkAjKa8tfS2rqkSW48vSRjHWrPxMk1KoyWILkuGV8XnA190w 8cqlRhCw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slHeV-0000000Fsen-2zBe; Tue, 03 Sep 2024 00:44:11 +0000 Received: from nyc.source.kernel.org ([2604:1380:45d1:ec00::3]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slHdb-0000000FsYf-1R2b for linux-arm-kernel@lists.infradead.org; Tue, 03 Sep 2024 00:43:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 48629A406E5; Tue, 3 Sep 2024 00:43:06 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 14990C4CEC2; Tue, 3 Sep 2024 00:43:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725324192; bh=2LcdvhbJjQlCVDeUbqNLSdBIUIGgAwUZWz+vOG/kTjQ=; h=From:Date:Subject:To:Cc:From; b=e6wPJg3xMVqbo5LlbQsz6rOERdc7Bqnhb4N8juGbStcMjl97GbLTHb/KZ3Pe9LzV+ pMybvQC1DamS0bQ+Yc1KDY2gOUfMtF/wCya+YbNbp37SliZMLe22nM+SBEZI6cOsXk pPAo21WL3tA1acniXxkT43/ISsuwAt9QCIIfePqdoo8xHZ2g2XnNsyZFeKZ5rqPrfj 2fXkffKRk8XBjpydGxDB8oUVNZSXVHDXgvYsGe/+OUnBJ/wtd1EC9rRHa1L9F3yqc6 80MM9qJNVr0MYmsixcDHhZbIZ7sxnuLP2RkttlY/J2mTGgvdlXMBs5zSEdJH+QpQE6 V381O69FHASIQ== From: Nathan Chancellor Date: Mon, 02 Sep 2024 17:43:06 -0700 Subject: [PATCH] spi: Revert "spi: Insert the missing pci_dev_put()before return" MIME-Version: 1.0 Message-Id: <20240902-spi-revert-8a0ec8c2d736-v1-1-928b829fed2b@kernel.org> X-B4-Tracking: v=1; b=H4sIAJlb1mYC/x2MywqAIBAAfyX23MJmL+tXooPpWnup0IhA+vek4 8DMJIgchCOMRYLAt0Q59gxVWYDdzL4yissMilRDAymMp2AWOVyoDbHVVrm+7lAPrTFEi/PWQ67 PwF6e/zzN7/sBgmO9a2kAAAA= To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Mark Brown , Yang Ruibin <11162571@vivo.com> Cc: linux-arm-kernel@lists.infradead.org, linux-spi@vger.kernel.org, llvm@lists.linux.dev, patches@lists.linux.dev, Geert Uytterhoeven , Nathan Chancellor X-Mailer: b4 0.15-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=2485; i=nathan@kernel.org; h=from:subject:message-id; bh=2LcdvhbJjQlCVDeUbqNLSdBIUIGgAwUZWz+vOG/kTjQ=; b=owGbwMvMwCUmm602sfCA1DTG02pJDGnXoud/v6co/Oz+68yXt7PSWHY/2t33yklsn/5RySVc2 2cc6dw9q6OUhUGMi0FWTJGl+rHqcUPDOWcZb5yaBDOHlQlkCAMXpwBcJI+R4cef7yxFWpvvGLT/ ObRTpedjjLnMJh+t8sMLlrR89b/zWI6RYd4VSd90+aAd6z8+Ohk07Zp0wdpGpYn33yut2CU67b/ NaV4A X-Developer-Key: i=nathan@kernel.org; a=openpgp; fpr=2437CB76E544CB6AB3D9DFD399739260CB6CB716 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_174315_548924_5B6F0F44 X-CRM114-Status: GOOD ( 11.41 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Commit 8a0ec8c2d736 ("spi: Insert the missing pci_dev_put()before return") added two uses of pci_dev_put() with an uninitialized dma_dev, resulting in the following compiler warnings (or errors with CONFIG_WERROR) when building with clang: drivers/spi/spi-pxa2xx-pci.c:150:15: error: variable 'dma_dev' is uninitialized when used here [-Werror,-Wuninitialized] 150 | pci_dev_put(dma_dev); | ^~~~~~~ drivers/spi/spi-pxa2xx-pci.c:228:15: error: variable 'dma_dev' is uninitialized when used here [-Werror,-Wuninitialized] 228 | pci_dev_put(dma_dev); | ^~~~~~~ Commit 609d7ffdc421 ("spi: pxa2xx-pci: Balance reference count for PCI DMA device") added a call to pci_dev_put() via devm_add_action_or_reset() in case of failures, so the recent change was incorrect for multiple reasons. Revert it altogether. Fixes: 8a0ec8c2d736 ("spi: Insert the missing pci_dev_put()before return") Reported-by: Geert Uytterhoeven Closes: https://lore.kernel.org/CAMuHMdWNjo69_W6f+R9QJJOf8uF0htg2XazeS-yjugJv3UM+kg@mail.gmail.com/ Signed-off-by: Nathan Chancellor --- drivers/spi/spi-pxa2xx-pci.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) --- base-commit: 42afa0cec405abcaf9263378496a51ba16895252 change-id: 20240902-spi-revert-8a0ec8c2d736-895aa00bdfcf Best regards, diff --git a/drivers/spi/spi-pxa2xx-pci.c b/drivers/spi/spi-pxa2xx-pci.c index a7bf4568f9ec..cc8dcf782399 100644 --- a/drivers/spi/spi-pxa2xx-pci.c +++ b/drivers/spi/spi-pxa2xx-pci.c @@ -146,10 +146,8 @@ static int lpss_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) c->num_chipselect = 1; ret = pxa2xx_spi_pci_clk_register(dev, ssp, 50000000); - if (ret) { - pci_dev_put(dma_dev); + if (ret) return ret; - } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(PCI_SLOT(dev->devfn), 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev); @@ -224,10 +222,8 @@ static int mrfld_spi_setup(struct pci_dev *dev, struct pxa2xx_spi_controller *c) } ret = pxa2xx_spi_pci_clk_register(dev, ssp, 25000000); - if (ret) { - pci_dev_put(dma_dev); + if (ret) return ret; - } dma_dev = pci_get_slot(dev->bus, PCI_DEVFN(21, 0)); ret = devm_add_action_or_reset(&dev->dev, lpss_dma_put_device, dma_dev);