diff mbox series

[1/1] watchdog: stm32_iwdg: don't print an error on probe deferral

Message ID 20201106094627.21132-1-christophe.roullier@st.com (mailing list archive)
State New, archived
Headers show
Series [1/1] watchdog: stm32_iwdg: don't print an error on probe deferral | expand

Commit Message

Christophe Roullier Nov. 6, 2020, 9:46 a.m. UTC
From: Etienne Carriere <etienne.carriere@st.com>

Do not print an error trace when deferring probe for clock resources.

Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
---
 drivers/watchdog/stm32_iwdg.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Ahmad Fatoum Nov. 6, 2020, 9:47 a.m. UTC | #1
Hello Christophe,

On 11/6/20 10:46 AM, Christophe Roullier wrote:
> From: Etienne Carriere <etienne.carriere@st.com>
> 
> Do not print an error trace when deferring probe for clock resources.
> 
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
> ---
>  drivers/watchdog/stm32_iwdg.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
> index 25188d6bbe15..1b71c205cee0 100644
> --- a/drivers/watchdog/stm32_iwdg.c
> +++ b/drivers/watchdog/stm32_iwdg.c
> @@ -163,7 +163,8 @@ static int stm32_iwdg_clk_init(struct platform_device *pdev,
>  
>  	wdt->clk_lsi = devm_clk_get(dev, "lsi");
>  	if (IS_ERR(wdt->clk_lsi)) {
> -		dev_err(dev, "Unable to get lsi clock\n");
> +		if (PTR_ERR(wdt->clk_lsi) != -EPROBE_DEFER)
> +			dev_err(dev, "Unable to get lsi clock\n");

Can you use dev_err_probe instead?

Cheers,
Ahmad

>  		return PTR_ERR(wdt->clk_lsi);
>  	}
>  
> @@ -171,7 +172,8 @@ static int stm32_iwdg_clk_init(struct platform_device *pdev,
>  	if (wdt->data->has_pclk) {
>  		wdt->clk_pclk = devm_clk_get(dev, "pclk");
>  		if (IS_ERR(wdt->clk_pclk)) {
> -			dev_err(dev, "Unable to get pclk clock\n");
> +			if (PTR_ERR(wdt->clk_pclk) != -EPROBE_DEFER)
> +				dev_err(dev, "Unable to get pclk clock\n");
>  			return PTR_ERR(wdt->clk_pclk);
>  		}
>  
>
Guenter Roeck Nov. 6, 2020, 1:06 p.m. UTC | #2
On Fri, Nov 06, 2020 at 10:46:27AM +0100, Christophe Roullier wrote:
> From: Etienne Carriere <etienne.carriere@st.com>
> 
> Do not print an error trace when deferring probe for clock resources.
> 
> Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
> Signed-off-by: Christophe Roullier <christophe.roullier@st.com>
> ---
>  drivers/watchdog/stm32_iwdg.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
> index 25188d6bbe15..1b71c205cee0 100644
> --- a/drivers/watchdog/stm32_iwdg.c
> +++ b/drivers/watchdog/stm32_iwdg.c
> @@ -163,7 +163,8 @@ static int stm32_iwdg_clk_init(struct platform_device *pdev,
>  
>  	wdt->clk_lsi = devm_clk_get(dev, "lsi");
>  	if (IS_ERR(wdt->clk_lsi)) {
> -		dev_err(dev, "Unable to get lsi clock\n");
> +		if (PTR_ERR(wdt->clk_lsi) != -EPROBE_DEFER)
> +			dev_err(dev, "Unable to get lsi clock\n");
>  		return PTR_ERR(wdt->clk_lsi);

I would suggest to use
		return dev_err_probe(dev, PTR_ERR(wdt->clk_lsi), "Unable to get lsi clock\n");

Guenter

>  	}
>  
> @@ -171,7 +172,8 @@ static int stm32_iwdg_clk_init(struct platform_device *pdev,
>  	if (wdt->data->has_pclk) {
>  		wdt->clk_pclk = devm_clk_get(dev, "pclk");
>  		if (IS_ERR(wdt->clk_pclk)) {
> -			dev_err(dev, "Unable to get pclk clock\n");
> +			if (PTR_ERR(wdt->clk_pclk) != -EPROBE_DEFER)
> +				dev_err(dev, "Unable to get pclk clock\n");
>  			return PTR_ERR(wdt->clk_pclk);
>  		}
>  
> -- 
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/watchdog/stm32_iwdg.c b/drivers/watchdog/stm32_iwdg.c
index 25188d6bbe15..1b71c205cee0 100644
--- a/drivers/watchdog/stm32_iwdg.c
+++ b/drivers/watchdog/stm32_iwdg.c
@@ -163,7 +163,8 @@  static int stm32_iwdg_clk_init(struct platform_device *pdev,
 
 	wdt->clk_lsi = devm_clk_get(dev, "lsi");
 	if (IS_ERR(wdt->clk_lsi)) {
-		dev_err(dev, "Unable to get lsi clock\n");
+		if (PTR_ERR(wdt->clk_lsi) != -EPROBE_DEFER)
+			dev_err(dev, "Unable to get lsi clock\n");
 		return PTR_ERR(wdt->clk_lsi);
 	}
 
@@ -171,7 +172,8 @@  static int stm32_iwdg_clk_init(struct platform_device *pdev,
 	if (wdt->data->has_pclk) {
 		wdt->clk_pclk = devm_clk_get(dev, "pclk");
 		if (IS_ERR(wdt->clk_pclk)) {
-			dev_err(dev, "Unable to get pclk clock\n");
+			if (PTR_ERR(wdt->clk_pclk) != -EPROBE_DEFER)
+				dev_err(dev, "Unable to get pclk clock\n");
 			return PTR_ERR(wdt->clk_pclk);
 		}