diff mbox series

[07/10] clk: meson: Simplify with dev_err_probe()

Message ID 20200902150348.14465-7-krzk@kernel.org (mailing list archive)
State New, archived
Delegated to: Neil Armstrong
Headers show
Series [01/10] clk: at91: Drop unused at91sam9g45_pcr_layout | expand

Commit Message

Krzysztof Kozlowski Sept. 2, 2020, 3:03 p.m. UTC
Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and the error value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
---
 drivers/clk/meson/axg-audio.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

Comments

Jerome Brunet Sept. 7, 2020, 8:30 a.m. UTC | #1
On Wed 02 Sep 2020 at 17:03, Krzysztof Kozlowski <krzk@kernel.org> wrote:

> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and the error value gets printed.
>
> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>

Acked-by: Jerome Brunet <jbrunet@baylibre.com>

> ---
>  drivers/clk/meson/axg-audio.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
> index 53715e36326c..dc22b0c45743 100644
> --- a/drivers/clk/meson/axg-audio.c
> +++ b/drivers/clk/meson/axg-audio.c
> @@ -1509,12 +1509,8 @@ static int devm_clk_get_enable(struct device *dev, char *id)
>  	int ret;
>  
>  	clk = devm_clk_get(dev, id);
> -	if (IS_ERR(clk)) {
> -		ret = PTR_ERR(clk);
> -		if (ret != -EPROBE_DEFER)
> -			dev_err(dev, "failed to get %s", id);
> -		return ret;
> -	}
> +	if (IS_ERR(clk))
> +		return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s", id);
>  
>  	ret = clk_prepare_enable(clk);
>  	if (ret) {
diff mbox series

Patch

diff --git a/drivers/clk/meson/axg-audio.c b/drivers/clk/meson/axg-audio.c
index 53715e36326c..dc22b0c45743 100644
--- a/drivers/clk/meson/axg-audio.c
+++ b/drivers/clk/meson/axg-audio.c
@@ -1509,12 +1509,8 @@  static int devm_clk_get_enable(struct device *dev, char *id)
 	int ret;
 
 	clk = devm_clk_get(dev, id);
-	if (IS_ERR(clk)) {
-		ret = PTR_ERR(clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "failed to get %s", id);
-		return ret;
-	}
+	if (IS_ERR(clk))
+		return dev_err_probe(dev, PTR_ERR(clk), "failed to get %s", id);
 
 	ret = clk_prepare_enable(clk);
 	if (ret) {