linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <error27@gmail.com>
To: daniel.lezcano@linaro.org
Cc: linux-pm@vger.kernel.org
Subject: [bug report] thermal/drivers/intel: Use generic trip points int340x
Date: Tue, 24 Jan 2023 18:12:49 +0300	[thread overview]
Message-ID: <Y8/1ccQLn41w+Vek@kili> (raw)

Hello Daniel Lezcano,

The patch 0d568e144ead: "thermal/drivers/intel: Use generic trip
points int340x" from Jan 13, 2023, leads to the following Smatch
static checker warning:

	drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c:137 int340x_thermal_zone_add()
	error: uninitialized symbol 'trip_cnt'.

drivers/thermal/intel/int340x_thermal/int340x_thermal_zone.c
    127         if (get_temp)
    128                 int34x_thermal_zone->ops->get_temp = get_temp;
    129 
    130         status = acpi_evaluate_integer(adev->handle, "PATC", NULL, &trip_cnt);
    131         if (!ACPI_FAILURE(status)) {
    132                 int34x_thermal_zone->aux_trip_nr = trip_cnt;
    133                 trip_mask = BIT(trip_cnt) - 1;
    134         }

"trip_cnt" not initialized on error path.

    135 
    136         int34x_thermal_zone->trips = kzalloc(sizeof(*int34x_thermal_zone->trips) *
--> 137                                              (INT340X_THERMAL_MAX_TRIP_COUNT + trip_cnt),
                                                                                       ^^^^^^^^

    138                                               GFP_KERNEL);
    139         if (!int34x_thermal_zone->trips) {
    140                 ret = -ENOMEM;
    141                 goto err_trips_alloc;
    142         }
    143 
    144         trip_cnt = int340x_thermal_read_trips(int34x_thermal_zone);
    145 
    146         for (i = 0; i < trip_cnt; ++i)
    147                 int34x_thermal_zone->trips[i].hysteresis = thermal_acpi_trip_gtsh(adev);

regards,
dan carpenter

             reply	other threads:[~2023-01-24 15:12 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 15:12 Dan Carpenter [this message]
2023-01-24 16:31 ` [PATCH] thermal/drivers/int340x: Fix uninitialized trip_cnt variable Daniel Lezcano
2023-01-24 16:41   ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y8/1ccQLn41w+Vek@kili \
    --to=error27@gmail.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=linux-pm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).