PCI: dw-rockchip: Add error messages in .probe()s error paths
Subsystems (3)
PATCH v2 1/1 PCI: dw-rockchip: Add error messages in .probe()s error paths
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.
---
Hello,
changes since (implicit) v1, sent with Message-Id:
[email protected]:
- 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(-)
drivers/pci/controller/dwc/pcie-dw-rockchip.c +13 -8
@@ -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
Signature · 1 line
2.43.0
Quoted 6 lines · Uwe Kleine-König
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 <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Quoted 6 lines · Uwe Kleine-König
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 <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>
- Mani
Quoted 74 lines
---
Hello,changes since (implicit) v1, sent with Message-Id:
[email protected]:- use dev instead of
rockchip->pci.devas 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
Uwedrivers/pci/controller/dwc/pcie-dw-rockchip.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/pci/controller/dwc/pcie-dw-rockchip.c +13
-8@@ -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:
6613476e225e090cc9aad49be7fa504e290dd33dSignature · 1 line
2.43.0
Signature · 1 line
மணிவண்ணன் சதாசிவம்
Quoted 6 lines · Uwe Kleine-König
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 <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>
Krzysztof applied this to pci/controller/rockchip with Reviewed-by from Jesper and Mani, but his outgoing mail queue got stuck. Trying to squeeze into v6.9.
Quoted 79 lines
---
Hello,changes since (implicit) v1, sent with Message-Id:
[email protected]:- use dev instead of
rockchip->pci.devas 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
Uwedrivers/pci/controller/dwc/pcie-dw-rockchip.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/pci/controller/dwc/pcie-dw-rockchip.c +13
-8@@ -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:
6613476e225e090cc9aad49be7fa504e290dd33dSignature · 7 lines
2.43.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Quoted 11 lines · Bjorn Helgaas
Quoted 6 lines · Uwe Kleine-König
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 <[email protected]>Signed-off-by Uwe Kleine-König <[email protected]>Krzysztof applied this to pci/controller/rockchip with Reviewed-by from Jesper and Mani, but his outgoing mail queue got stuck. Trying to squeeze into v6.9.
Sorry, v6.10. v6.9 is already done, obviously.
Quoted 79 lines
Quoted 79 lines
---
Hello,changes since (implicit) v1, sent with Message-Id:
[email protected]:- use dev instead of
rockchip->pci.devas 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
Uwedrivers/pci/controller/dwc/pcie-dw-rockchip.c | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-)drivers/pci/controller/dwc/pcie-dw-rockchip.c +13
-8@@ -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:
6613476e225e090cc9aad49be7fa504e290dd33dSignature · 7 lines
2.43.0 _______________________________________________ linux-arm-kernel mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Krzysztof Wilczyński
AppliedQuoted 3 lines
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.
Applied to controller/rockchip, thank you!
[1/1] PCI: dw-rockchip: Add error messages in .probe()s error paths
https://git.kernel.org/pci/pci/c/8ab425aa02ac Krzysztof