]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
thermal/drivers/broadcom: Simplify with dev_err_probe()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Tue, 9 Jul 2024 12:59:33 +0000 (14:59 +0200)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Mon, 15 Jul 2024 11:31:40 +0000 (13:31 +0200)
Error handling in probe() can be a bit simpler with dev_err_probe().

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Link: https://lore.kernel.org/r/20240709-thermal-probe-v1-3-241644e2b6e0@linaro.org
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
drivers/thermal/broadcom/bcm2835_thermal.c

index 38fb0c8cd55eeab88712bae99d0abd8369175f67..5ad87eb3f5781722ffd1f996b4252245f6bc10b1 100644 (file)
@@ -186,12 +186,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
        }
 
        data->clk = devm_clk_get_enabled(dev, NULL);
-       if (IS_ERR(data->clk)) {
-               err = PTR_ERR(data->clk);
-               if (err != -EPROBE_DEFER)
-                       dev_err(dev, "Could not get clk: %d\n", err);
-               return err;
-       }
+       if (IS_ERR(data->clk))
+               return dev_err_probe(dev, PTR_ERR(data->clk), "Could not get clk\n");
 
        rate = clk_get_rate(data->clk);
        if ((rate < 1920000) || (rate > 5000000))
@@ -201,11 +197,8 @@ static int bcm2835_thermal_probe(struct platform_device *pdev)
 
        /* register of thermal sensor and get info from DT */
        tz = devm_thermal_of_zone_register(dev, 0, data, &bcm2835_thermal_ops);
-       if (IS_ERR(tz)) {
-               err = PTR_ERR(tz);
-               dev_err(dev, "Failed to register the thermal device: %d\n", err);
-               return err;
-       }
+       if (IS_ERR(tz))
+               return dev_err_probe(dev, PTR_ERR(tz), "Failed to register the thermal device\n");
 
        /*
         * right now the FW does set up the HW-block, so we are not