From: sashiko-bot@kernel.org
To: "Sachin Gupta" <sachin.gupta@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/2] thermal: qcom: Add support for Qualcomm MBG thermal monitoring
Date: Mon, 06 Jul 2026 08:26:38 +0000 [thread overview]
Message-ID: <20260706082639.3308D1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260706-spmi-mbg-driver-v2-2-f883ff1d8719@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The `mbg_tm_set_trip_temp` callback incorrectly treats `INT_MAX` as an out-of-bounds error, printing a spurious error message and returning `-ERANGE` when the thermal framework attempts to disable the upper trip point.
--
commit 11624a52601424e2e0de79b12ee193bdaf63ce36
Author: Satya Priya Kakitapalli <quic_skakitap@quicinc.com>
thermal: qcom: Add support for Qualcomm MBG thermal monitoring
This commit adds a driver for the Qualcomm MBG thermal monitoring device.
It registers a thermal zone device and sets up interrupt handling for
temperature threshold violations.
> diff --git a/drivers/thermal/qcom/qcom-spmi-mbg-tm.c b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c
> new file mode 100644
> index 0000000000000..fa2f10002253f
> --- /dev/null
> +++ b/drivers/thermal/qcom/qcom-spmi-mbg-tm.c
[ ... ]
> +static int mbg_tm_set_trip_temp(struct thermal_zone_device *tz, int low_temp,
> + int temp)
> +{
> + struct mbg_tm_chip *chip = thermal_zone_device_priv(tz);
> + int ret = 0;
> +
> + guard(mutex)(&chip->lock);
> +
> + /* The HW has a limitation that the trip set must be above 25C */
> + if (temp > MBG_MIN_TRIP_TEMP && temp < MBG_MAX_SUPPORTED_TEMP) {
> + ret = regmap_write(chip->map, chip->base + MON2_LVL1_UP_THRESH,
> + temp_to_vtemp_mv(temp));
> + if (ret < 0)
> + return ret;
> +
> + ret = regmap_set_bits(chip->map, chip->base + MBG_TEMP_MON2_MISC_CFG,
> + MON2_UP_THRESH_EN);
> + if (ret < 0)
> + return ret;
> + } else {
> + dev_err(chip->dev, "Set trip b/w 25C and 160C\n");
> + ret = regmap_clear_bits(chip->map, chip->base + MBG_TEMP_MON2_MISC_CFG,
> + MON2_UP_THRESH_EN);
> + return -ERANGE;
> + }
[Severity: Medium]
Will this cause spurious errors when the thermal core attempts to disable
the trip point?
When the thermal subsystem determines that no upper trip point is needed,
it typically passes INT_MAX for the upper limit to disable the trip point.
While this code correctly clears MON2_UP_THRESH_EN to disable the trip,
it also logs a "Set trip b/w 25C and 160C" error and returns -ERANGE.
The thermal core will then likely log its own error about failing to set
the trips.
Should we handle INT_MAX explicitly as a request to disable the threshold,
rather than treating it as an out-of-bounds error?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260706-spmi-mbg-driver-v2-0-f883ff1d8719@oss.qualcomm.com?part=2
next prev parent reply other threads:[~2026-07-06 8:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-06 8:14 [PATCH v2 0/2] thermal: qcom: Add Qualcomm SPMI MBG thermal monitor support Sachin Gupta
2026-07-06 8:14 ` [PATCH v2 1/2] dt-bindings: thermal: Add Qualcomm " Sachin Gupta
2026-07-06 8:14 ` [PATCH v2 2/2] thermal: qcom: Add support for Qualcomm MBG thermal monitoring Sachin Gupta
2026-07-06 8:26 ` sashiko-bot [this message]
2026-07-06 10:33 ` Konrad Dybcio
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=20260706082639.3308D1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=sachin.gupta@oss.qualcomm.com \
--cc=sashiko-reviews@lists.linux.dev \
/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