From: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
To: "Uwe Kleine-König" <ukleinek@debian.org>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Heiko Stuebner" <heiko@sntech.de>,
"Lei Chuanhua" <lchuanhua@maxlinear.com>,
"Jesper Nilsson" <jesper.nilsson@axis.com>,
"Nobuhiro Iwamatsu" <nobuhiro1.iwamatsu@toshiba.co.jp>,
"Yoshihiro Shimoda" <yoshihiro.shimoda.uh@renesas.com>,
"Serge Semin" <fancer.lancer@gmail.com>,
"Damien Le Moal" <dlemoal@kernel.org>,
"Rob Herring" <robh@kernel.org>,
linux-pci@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-rockchip@lists.infradead.org
Subject: Re: [PATCH v2] PCI: dw-rockchip: Add error messages in .probe()s error paths
Date: Sun, 10 Mar 2024 18:40:43 +0530 [thread overview]
Message-ID: <20240310131043.GD3390@thinkpad> (raw)
In-Reply-To: <20240227141256.413055-2-ukleinek@debian.org>
On Tue, Feb 27, 2024 at 03:12:54PM +0100, Uwe Kleine-König wrote:
> 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 <heiko@sntech.de>
> Signed-off-by: Uwe Kleine-König <ukleinek@debian.org>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
- Mani
> ---
> 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(-)
>
> 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);
>
> base-commit: 6613476e225e090cc9aad49be7fa504e290dd33d
> --
> 2.43.0
>
--
மணிவண்ணன் சதாசிவம்
next prev parent reply other threads:[~2024-03-10 13:10 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-27 14:12 [PATCH v2] PCI: dw-rockchip: Add error messages in .probe()s error paths Uwe Kleine-König
2024-02-28 9:52 ` Jesper Nilsson
2024-03-10 13:10 ` Manivannan Sadhasivam [this message]
2024-05-15 20:57 ` Bjorn Helgaas
2024-05-15 21:13 ` Bjorn Helgaas
2024-05-17 11:18 ` Krzysztof Wilczyński
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240310131043.GD3390@thinkpad \
--to=manivannan.sadhasivam@linaro.org \
--cc=bhelgaas@google.com \
--cc=dlemoal@kernel.org \
--cc=fancer.lancer@gmail.com \
--cc=heiko@sntech.de \
--cc=jesper.nilsson@axis.com \
--cc=kw@linux.com \
--cc=lchuanhua@maxlinear.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-rockchip@lists.infradead.org \
--cc=lpieralisi@kernel.org \
--cc=nobuhiro1.iwamatsu@toshiba.co.jp \
--cc=robh@kernel.org \
--cc=ukleinek@debian.org \
--cc=yoshihiro.shimoda.uh@renesas.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).