From patchwork Tue Feb 27 11:18:35 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: 13573563 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 88557C54798 for ; Tue, 27 Feb 2024 11:19:36 +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=nZ2gXhE5U9bM/N0/+aLrMi++400RHzp4peyu0EBIl2U=; b=T2OOMcFfyWFp5g 9TY8MBd/oJUyBlYbXrocpylBqFahm3WUeLQWpvvTyQWOYalfB70m86r2W9XkrLOg2Dd6PaYuytR5i Wf5Zk1YeRACZ5Da2rdP/RqnlbJ7zep3Th9Vhqna0uQhroSwH2lZjx1NWsicCOiZHuIsGNfnytQMjG RtGboGtFS8l8FYmsfz4D9oxunbwK7aXPsSPSteIIkUaXBKU4qA9QfPb1iykokMDpjyMnat+/NMQ47 VOZv8DL6b2jpIHrB3ydQeg4mmkHl9IcDJIJCHVljhlSrxEuLTQlFHv5wZjSKs36qW+drNgpto4PSK V8szm0uPuehYmKMO4cCA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1revUb-00000004v43-39QE; Tue, 27 Feb 2024 11:19:25 +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 1revUY-00000004v37-2CJV; Tue, 27 Feb 2024 11:19:23 +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=u0E2Diup0AiiVMnnreZGh7XxC7/vc7JDGyBFgrh4bLE=; b=Du jlSMdt/csM2FIIOZ1AS0n0P83As7aMdCWOJDjmcrIPqgtls2EuAIK82ShyD0YrcEMMV0y+eCXH304 XTaI6pWoBHkLI8UxcAmUJKYoqj47O99ek4DOeObVnmY2Hi+pQllVh26StMO4oqrUVvahhyGTRedlO etXa7iqGxm+Zt15NDVgRZ0ZrSd9uDQsHb8fGjkvxILNVul4p/HAtB88s4a8ME3WDTVDKMRTwMl3Hs AvL9eq1q/vm64lmkCcBPxHeBs/oMbUufb6UF4aclAvqkSFGsCPUWI7rx/vHk+SOjRdtxjEjKZ/uXy vES0PJWlqPXNuYrgIggl5A071H4A7mnQ==; Received: from ukleinek by master.debian.org with local (Exim 4.94.2) (envelope-from ) id 1revU5-005dFm-EL; Tue, 27 Feb 2024 11:18:53 +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 , Damien Le Moal Cc: Rob Herring , linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org Subject: [PATCH] PCI: dw-rockchip: Add error messages in .probe()s error paths Date: Tue, 27 Feb 2024 12:18:35 +0100 Message-ID: <20240227111837.395422-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=2503; i=ukleinek@debian.org; h=from:subject; bh=S9/+LCdR6jnIUOPSc20FoU3XYkHo/paVrIUASEIKU+w=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl3cUO3qnSxDO51sVKwCI6WeHaZXuaDt0oaGYFH AP8pZoKluCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZd3FDgAKCRCPgPtYfRL+ TpAOB/9Or1GBTlt/LmDI3zIRKVEm+fzI/Ak/c4hElCMqqpxElSkjIdgVrX9Q7wVoMgpqcoKrqCn +ENT4zaE1WtEsts6EhE2NsI1g4dzT8vdDQ3+zOSA/Q1mhQJh8RtBAD5IeZyRXIMPeDj3b1d8mMc tD68hrGU+/C4kyap3lil5NMgGgvcwBabDrXWmE3LSSo30x5JaIoF/0io/vqt2Z6mqZ8EzzfWO2P ErXpSJK1kQYODWlFTbsbUxhZ2u4DlTqR3VCeKuSgOMSRjCE4MbCnRsCehX0TmQnaOsOzZxzlHxh 58dIJQdt8balEQlp3Zu1DZGd71McdGBGyPleT1FX3yTGcT+O 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_031922_596001_7DBCC1A1 X-CRM114-Status: GOOD ( 12.51 ) 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. Signed-off-by: Uwe Kleine-König Reviewed-by: Heiko Stuebner --- drivers/pci/controller/dwc/pcie-dw-rockchip.c | 23 ++++++++++++------- 1 file changed, 15 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..4c16d8d2e178 100644 --- a/drivers/pci/controller/dwc/pcie-dw-rockchip.c +++ b/drivers/pci/controller/dwc/pcie-dw-rockchip.c @@ -225,11 +225,17 @@ 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(rockchip->pci.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(rockchip->pci.dev, ret, + "failed to enable clocks\n"); + + return 0; } static int rockchip_pcie_resource_get(struct platform_device *pdev, @@ -237,12 +243,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 +328,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);