thermal/drivers/int340x: Fix uninitialized trip_cnt variable

Message ID 20230124163127.445942-1-daniel.lezcano@linaro.org
State New
Headers
Series thermal/drivers/int340x: Fix uninitialized trip_cnt variable |

Commit Message

Daniel Lezcano Jan. 24, 2023, 4:31 p.m. UTC
  The conversion to the generic trip points missed to initializes the
extra trip points to zero in case the _PATC method is not found.

Set by default the trip_cnt to zero.

Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
---
 drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Rafael J. Wysocki Jan. 24, 2023, 4:41 p.m. UTC | #1
On Tue, Jan 24, 2023 at 5:35 PM Daniel Lezcano
<daniel.lezcano@linaro.org> wrote:
>
> The conversion to the generic trip points missed to initializes the
> extra trip points to zero in case the _PATC method is not found.

The _PATC name is incorrect.

> Set by default the trip_cnt to zero.
>
> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
> ---
>  drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> index 7ff5d9b1c490..c113962a599e 100644
> --- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> +++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
> @@ -121,7 +121,7 @@ struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
>  {
>         struct int34x_thermal_zone *int34x_thermal_zone;
>         acpi_status status;
> -       unsigned long long trip_cnt;
> +       unsigned long long trip_cnt = 0;
>         int trip_mask = 0;
>         int i, ret;
>
> --

I've just posted an equivalent fix and I prefer mine.
  

Patch

diff --git a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
index 7ff5d9b1c490..c113962a599e 100644
--- a/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
+++ b/drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
@@ -121,7 +121,7 @@  struct int34x_thermal_zone *int340x_thermal_zone_add(struct acpi_device *adev,
 {
 	struct int34x_thermal_zone *int34x_thermal_zone;
 	acpi_status status;
-	unsigned long long trip_cnt;
+	unsigned long long trip_cnt = 0;
 	int trip_mask = 0;
 	int i, ret;