diff mbox series

phy: bcm-ns-usb2: improve printing ref clk errors

Message ID 20211123094823.25445-1-zajec5@gmail.com
State Superseded
Headers show
Series phy: bcm-ns-usb2: improve printing ref clk errors | expand

Commit Message

Rafał Miłecki Nov. 23, 2021, 9:48 a.m. UTC
From: Rafał Miłecki <rafal@milecki.pl>

Print actual error number to help debugging issues but also avoid
printing -EPROBE_DEFER.

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
---
 drivers/phy/broadcom/phy-bcm-ns-usb2.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

Comments

Florian Fainelli Nov. 23, 2021, 7:04 p.m. UTC | #1
On 11/23/21 1:48 AM, Rafał Miłecki wrote:
> From: Rafał Miłecki <rafal@milecki.pl>
> 
> Print actual error number to help debugging issues but also avoid
> printing -EPROBE_DEFER.
> 
> Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
> ---
>  drivers/phy/broadcom/phy-bcm-ns-usb2.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> index 98d32729a45d..4cb70785ccb4 100644
> --- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> +++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
> @@ -132,8 +132,12 @@ static int bcm_ns_usb2_probe(struct platform_device *pdev)
>  
>  	usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");
>  	if (IS_ERR(usb2->ref_clk)) {
> -		dev_err(dev, "Clock not defined\n");
> -		return PTR_ERR(usb2->ref_clk);
> +		int err = PTR_ERR(usb2->ref_clk);

dev_err_probe() should take care of that for you already.
diff mbox series

Patch

diff --git a/drivers/phy/broadcom/phy-bcm-ns-usb2.c b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
index 98d32729a45d..4cb70785ccb4 100644
--- a/drivers/phy/broadcom/phy-bcm-ns-usb2.c
+++ b/drivers/phy/broadcom/phy-bcm-ns-usb2.c
@@ -132,8 +132,12 @@  static int bcm_ns_usb2_probe(struct platform_device *pdev)
 
 	usb2->ref_clk = devm_clk_get(dev, "phy-ref-clk");
 	if (IS_ERR(usb2->ref_clk)) {
-		dev_err(dev, "Clock not defined\n");
-		return PTR_ERR(usb2->ref_clk);
+		int err = PTR_ERR(usb2->ref_clk);
+
+		if (err != -EPROBE_DEFER)
+			dev_err(dev, "Failed to get ref clk: %d\n", err);
+
+		return err;
 	}
 
 	usb2->phy = devm_phy_create(dev, NULL, &ops);