From patchwork Tue Feb 27 14:12:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13573856 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 8D8D4C54798 for ; Tue, 27 Feb 2024 14:13:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-ID:Date:Subject:Cc :To: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=KBdRfaSa1Lf63RZnQebGwIi0/DKQMMmyQrQ1Mj2dOG0=; b=kKxXdQIAtJFlcO njIzp0tmWJeP7lomv5Dh5zYGydyXhUC1XYzNC7fs7ei0zH/cQpmBe90uc0y0ZJLCwJIGJsMTmmULZ kTpLujX50z1pmQp5/NoWU/uP6L0G3J+MBQzGBwqqeA507ALM32kj2tYDgF7wACMilGcW93HooWc3y erV+ReQv0m51k4BjayIIPOg115NL8xI549iz/JINdv3zMbZIwitpcSlXoWssYmtejHVdw2/X3eFmq 3xmFklGZB8L6+OMvzd5o51S+xQqlbu1qkAkTd6PauPQ5n3EC5gD7RJy7wa7QsqU0hOoiVTYK6Ny6V xmPqQdFUvqYIZcKFr+Sg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1reyDA-00000005XBV-049n; Tue, 27 Feb 2024 14:13:36 +0000 Received: from master.debian.org ([2001:41b8:202:deb:216:36ff:fe40:4001]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1reyD6-00000005X9h-1EZ4; Tue, 27 Feb 2024 14:13:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debian.org; s=smtpauto.master; h=Content-Transfer-Encoding:Content-Type:MIME-Version: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: In-Reply-To:References; bh=r7SFpf4dLvrRhxoKMvvgpekdUrqBq4F3M57BeGF5vkk=; b=Lj sQgTFxPzWXB/XJtOo+oF/TESN4qrao76zAkYQYPNL8mgnDhHQQqBvAfWBUlf1I6Ad4AgvOi4dTx5c XX95ndTj/8r8jpNlDpa0RKRHFR8POiNM/w97KKCQOM9SzHSRgaWzDz4R23lCyNo2WONRcKsU8nCqp IItbiq9F1Ftl6VK5czGYK1X62YQpCGjqDsqFGTA+BGN51FAnjDQlzQg5hC09V8qGXPMgubt1gwV32 H8wBoJmTbfw1/vhlFJgId5tHHY19f4rCzEfcZ+qFE7nBM/VFDUWkO/17CAd6HelyeDaAWhu2edi// jhwPMgt4+uDnlSXsUX4RY9XEi5hk/rcw==; Received: from ukleinek by master.debian.org with local (Exim 4.94.2) (envelope-from ) id 1reyCj-005mof-DF; Tue, 27 Feb 2024 14:13:09 +0000 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Lorenzo Pieralisi , =?utf-8?q?Krzysztof_Wilczy?= =?utf-8?q?=C5=84ski?= , Bjorn Helgaas , Heiko Stuebner , Lei Chuanhua , Manivannan Sadhasivam , Jesper Nilsson , Nobuhiro Iwamatsu , Yoshihiro Shimoda , Serge Semin , Damien Le Moal Cc: Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH v2] PCI: dw-rockchip: Add error messages in .probe()s error paths Date: Tue, 27 Feb 2024 15:12:54 +0100 Message-ID: <20240227141256.413055-2-ukleinek@debian.org> X-Mailer: git-send-email 2.43.0 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2830; i=ukleinek@debian.org; h=from:subject; bh=Nob6qN/qkCiuXvIB3sPabKHumbLsd+xpfv29HkFfRv4=; b=owEBbAGT/pANAwAKAY+A+1h9Ev5OAcsmYgBl3e3o1zR9lVs2UewhWb9uiYuT6ZDByWgZ1zlhu 9Rgm8F0V6uJATIEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZd3t6AAKCRCPgPtYfRL+ TicgB/YjJU19WoIDuzpBX2npPG7PwKGSw4RVyws3t9z1D9R3m/h/lLPA9QRrDgvEd3IOz7bdNSO WURcEuQZ/w2D+oRxsJ1e1EHrCiL6ro9ebIqSOHbCBky7ObE1oAXJw3beRTp5/LyiaxR/Czd/d82 RFg5XDDkhFgRoGDf8yruur/GmFXY1AWIOFbevUgEMQbNS9y/EoF+QYoLFEfPto0ZMhgVnPFmW3o 34lhojl5D3TUvp4ww600NJu9wGQFRlA8Y/ZxYfnCNLiKKIbghSo1MlmV7Aw9dbDIrWpuSJCF/9s 8SIt/kxYqFsEOt6vvF3kgT3s/NNDylXiAAoDZcfYUb9C9zs= X-Developer-Key: i=ukleinek@debian.org; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240227_061332_363237_1B349F3A X-CRM114-Status: GOOD ( 13.93 ) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+linux-rockchip=archiver.kernel.org@lists.infradead.org Drivers that silently fail to probe provide a bad user experience and make it unnecessarily hard to debug such a failure. Fix it by using dev_err_probe() instead of a plain return. Reviewed-by: Heiko Stuebner Signed-off-by: Uwe Kleine-König Reviewed-by: Jesper Nilsson Reviewed-by: Manivannan Sadhasivam --- Hello, changes since (implicit) v1, sent with Message-Id: 20240227111837.395422-2-ukleinek@debian.org: - use dev instead of rockchip->pci.dev as noticed by Serge Semin. - added Reviewed-by: tag for Heiko. I assume he agrees to above improvement and adding the tag despite the change is fine. Best regards Uwe drivers/pci/controller/dwc/pcie-dw-rockchip.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d diff --git a/drivers/pci/controller/dwc/pcie-dw-rockchip.c b/drivers/pci/controller/dwc/pcie-dw-rockchip.c index d6842141d384..a13ca83ce260 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -225,11 +225,15 @@ static int rockchip_pcie_clk_init(struct rockchip_pcie *rockchip) ret = devm_clk_bulk_get_all(dev, &rockchip->clks); if (ret < 0) - return ret; + return dev_err_probe(dev, ret, "failed to get clocks\n"); rockchip->clk_cnt = ret; - return clk_bulk_prepare_enable(rockchip->clk_cnt, rockchip->clks); + ret = clk_bulk_prepare_enable(rockchip->clk_cnt, rockchip->clks); + if (ret) + return dev_err_probe(dev, ret, "failed to enable clocks\n"); + + return 0; } static int rockchip_pcie_resource_get(struct platform_device *pdev, @@ -237,12 +241,14 @@ static int rockchip_pcie_resource_get(struct platform_device *pdev, { rockchip->apb_base = devm_platform_ioremap_resource_byname(pdev, "apb"); if (IS_ERR(rockchip->apb_base)) - return PTR_ERR(rockchip->apb_base); + return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->apb_base), + "failed to map apb registers\n"); rockchip->rst_gpio = devm_gpiod_get_optional(&pdev->dev, "reset", GPIOD_OUT_HIGH); if (IS_ERR(rockchip->rst_gpio)) - return PTR_ERR(rockchip->rst_gpio); + return dev_err_probe(&pdev->dev, PTR_ERR(rockchip->rst_gpio), + "failed to get reset gpio\n"); rockchip->rst = devm_reset_control_array_get_exclusive(&pdev->dev); if (IS_ERR(rockchip->rst)) @@ -320,10 +326,9 @@ static int rockchip_pcie_probe(struct platform_device *pdev) rockchip->vpcie3v3 = NULL; } else { ret = regulator_enable(rockchip->vpcie3v3); - if (ret) { - dev_err(dev, "failed to enable vpcie3v3 regulator\n"); - return ret; - } + if (ret) + return dev_err_probe(dev, ret, + "failed to enable vpcie3v3 regulator\n"); } ret = rockchip_pcie_phy_init(rockchip);