Merge tag 'block-5.13-2021-05-14' of git://git.kernel.dk/linux-block
[linux-2.6-microblaze.git] / drivers / thermal / thermal_of.c
index 69ef12f..5b76f9a 100644 (file)
@@ -704,14 +704,17 @@ static int thermal_of_populate_bind_params(struct device_node *np,
 
        count = of_count_phandle_with_args(np, "cooling-device",
                                           "#cooling-cells");
-       if (!count) {
+       if (count <= 0) {
                pr_err("Add a cooling_device property with at least one device\n");
+               ret = -ENOENT;
                goto end;
        }
 
        __tcbp = kcalloc(count, sizeof(*__tcbp), GFP_KERNEL);
-       if (!__tcbp)
+       if (!__tcbp) {
+               ret = -ENOMEM;
                goto end;
+       }
 
        for (i = 0; i < count; i++) {
                ret = of_parse_phandle_with_args(np, "cooling-device",