Преглед на файлове

thermal: of: fix cleanup when building a thermal zone

of_node_put is iterating through all terms in the tbps array even though
the bind has failed. We need to only iterate through the terms that have
already passed the binding step.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: linux-pm@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Ulises Brindis <brindisu@lab126.com>
Signed-off-by: Eduardo Valentin <edubezval@gmail.com>
Ulises Brindis преди 9 години
родител
ревизия
1cd91c1820
променени са 1 файла, в които са добавени 1 реда и са изтрити 1 реда
  1. 1 1
      drivers/thermal/of-thermal.c

+ 1 - 1
drivers/thermal/of-thermal.c

@@ -906,7 +906,7 @@ finish:
 	return tz;
 
 free_tbps:
-	for (i = 0; i < tz->num_tbps; i++)
+	for (i = i - 1; i >= 0; i--)
 		of_node_put(tz->tbps[i].cooling_device);
 	kfree(tz->tbps);
 free_trips: