thermal/drivers/exynos: Handle devm_regulator_get_optional return value correctly
authorMateusz Majewski <m.majewski2@samsung.com>
Fri, 1 Dec 2023 09:56:20 +0000 (10:56 +0100)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Tue, 2 Jan 2024 08:33:19 +0000 (09:33 +0100)
Currently, if regulator is required in the SoC, but
devm_regulator_get_optional fails for whatever reason, the execution
will proceed without propagating the error. Meanwhile there is no
reason to output the error in case of -ENODEV.

Reviewed-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Mateusz Majewski <m.majewski2@samsung.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20231201095625.301884-5-m.majewski2@samsung.com
drivers/thermal/samsung/exynos_tmu.c

index c144592d45847800b7d299d23499237b12abfa60..8bcad8a70dc5ce6ab907a16d00df8786fb312f94 100644 (file)
@@ -1002,9 +1002,17 @@ static int exynos_tmu_probe(struct platform_device *pdev)
                        return ret;
                }
        } else {
-               if (PTR_ERR(data->regulator) == -EPROBE_DEFER)
+               ret = PTR_ERR(data->regulator);
+               switch (ret) {
+               case -ENODEV:
+                       break;
+               case -EPROBE_DEFER:
                        return -EPROBE_DEFER;
-               dev_info(&pdev->dev, "Regulator node (vtmu) not found\n");
+               default:
+                       dev_err(&pdev->dev, "Failed to get regulator: %d\n",
+                               ret);
+                       return ret;
+               }
        }
 
        ret = exynos_map_dt_data(pdev);