]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: scmi: process the result of devm_of_clk_add_hw_provider()
authorAlexandra Diupina <adiupina@astralinux.ru>
Tue, 5 Dec 2023 15:12:20 +0000 (18:12 +0300)
committerViresh Kumar <viresh.kumar@linaro.org>
Wed, 6 Dec 2023 06:10:11 +0000 (11:40 +0530)
devm_of_clk_add_hw_provider() may return an errno, so
add a return value check

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 8410e7f3b31e ("cpufreq: scmi: Fix OPP addition failure with a dummy clock provider")
Signed-off-by: Alexandra Diupina <adiupina@astralinux.ru>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/scmi-cpufreq.c

index c8a7ccc42c164f524c5202e743e945dfe4e5d4bc..4ee23f4ebf4a40bacf10c493c88b247dd1dff09e 100644 (file)
@@ -334,8 +334,11 @@ static int scmi_cpufreq_probe(struct scmi_device *sdev)
 
 #ifdef CONFIG_COMMON_CLK
        /* dummy clock provider as needed by OPP if clocks property is used */
-       if (of_property_present(dev->of_node, "#clock-cells"))
-               devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
+       if (of_property_present(dev->of_node, "#clock-cells")) {
+               ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get, NULL);
+               if (ret)
+                       return dev_err_probe(dev, ret, "%s: registering clock provider failed\n", __func__);
+       }
 #endif
 
        ret = cpufreq_register_driver(&scmi_cpufreq_driver);