ACPI: thermal_lib: Initialize temp_decik to zero
authorColin Ian King <colin.i.king@gmail.com>
Thu, 22 Feb 2024 10:57:23 +0000 (10:57 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 22 Feb 2024 19:36:17 +0000 (20:36 +0100)
Static analysis with clang scan build is warning that uninitialized
data is being passed into various functions. Stop these warnings by
initializing temp_decik to zero.

Cleans up clang scan warnings in lines 106, 125, 146 and 164 such as:
drivers/acpi/thermal_lib.c:106:9: warning: 2nd function call argument
is an uninitialized value [core.CallAndMessage]

Kudos to Dan Carpenter for the deeper analysis of this issue.

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/thermal_lib.c

index 4e0519ca9739eff3d1d301d192d52a83406c5327..6214d6ebe1fa31d16158fba9a501c6ed09c57d56 100644 (file)
@@ -100,7 +100,7 @@ static int thermal_temp(int error, int temp_decik, int *ret_temp)
  */
 int thermal_acpi_active_trip_temp(struct acpi_device *adev, int id, int *ret_temp)
 {
-       int temp_decik;
+       int temp_decik = 0;
        int ret = acpi_active_trip_temp(adev, id, &temp_decik);
 
        return thermal_temp(ret, temp_decik, ret_temp);
@@ -119,7 +119,7 @@ EXPORT_SYMBOL_GPL(thermal_acpi_active_trip_temp);
  */
 int thermal_acpi_passive_trip_temp(struct acpi_device *adev, int *ret_temp)
 {
-       int temp_decik;
+       int temp_decik = 0;
        int ret = acpi_passive_trip_temp(adev, &temp_decik);
 
        return thermal_temp(ret, temp_decik, ret_temp);
@@ -139,7 +139,7 @@ EXPORT_SYMBOL_GPL(thermal_acpi_passive_trip_temp);
  */
 int thermal_acpi_hot_trip_temp(struct acpi_device *adev, int *ret_temp)
 {
-       int temp_decik;
+       int temp_decik = 0;
        int ret = acpi_hot_trip_temp(adev, &temp_decik);
 
        return thermal_temp(ret, temp_decik, ret_temp);
@@ -158,7 +158,7 @@ EXPORT_SYMBOL_GPL(thermal_acpi_hot_trip_temp);
  */
 int thermal_acpi_critical_trip_temp(struct acpi_device *adev, int *ret_temp)
 {
-       int temp_decik;
+       int temp_decik = 0;
        int ret = acpi_critical_trip_temp(adev, &temp_decik);
 
        return thermal_temp(ret, temp_decik, ret_temp);