From: Greg KH <gregkh@linuxfoundation.org>
To: Hsin-Te Yuan <yuanhsinte@chromium.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Daniel Lezcano <daniel.lezcano@linaro.org>,
Amit Kucheria <amitk@kernel.org>, Zhang Rui <rui.zhang@intel.com>,
linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH 6.6] thermal/of: Fix mask mismatch when no trips subnode
Date: Thu, 10 Jul 2025 15:33:17 +0200 [thread overview]
Message-ID: <2025071012-granola-daylong-9943@gregkh> (raw)
In-Reply-To: <20250707-trip-point-v1-1-8f89d158eda0@chromium.org>
On Mon, Jul 07, 2025 at 06:27:10PM +0800, Hsin-Te Yuan wrote:
> After commit 725f31f300e3 ("thermal/of: support thermal zones w/o trips
> subnode") was backported on 6.6 stable branch as commit d3304dbc2d5f
> ("thermal/of: support thermal zones w/o trips subnode"), thermal zones
> w/o trips subnode still fail to register since `mask` argument is not
> set correctly. When number of trips subnode is 0, `mask` must be 0 to
> pass the check in `thermal_zone_device_register_with_trips()`.
>
> Set `mask` to 0 when there's no trips subnode.
>
> Signed-off-by: Hsin-Te Yuan <yuanhsinte@chromium.org>
> ---
> drivers/thermal/thermal_of.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/thermal_of.c b/drivers/thermal/thermal_of.c
> index 0f520cf923a1e684411a3077ad283551395eec11..97aeb869abf5179dfa512dd744725121ec7fd0d9 100644
> --- a/drivers/thermal/thermal_of.c
> +++ b/drivers/thermal/thermal_of.c
> @@ -514,7 +514,7 @@ static struct thermal_zone_device *thermal_of_zone_register(struct device_node *
> of_ops->bind = thermal_of_bind;
> of_ops->unbind = thermal_of_unbind;
>
> - mask = GENMASK_ULL((ntrips) - 1, 0);
> + mask = ntrips ? GENMASK_ULL((ntrips) - 1, 0) : 0;
Meta-comment, I hate ? : lines in C, especially when they are not
needed, like here. Spell this out, with a real if statement please, so
that we can read and easily understand what is going on.
That being said, I agree with Rafael, let's do whatever is in mainline
instead. Fix it the same way it was fixed there by backporting the
relevant commits.
thanks,
greg k-h
next prev parent reply other threads:[~2025-07-10 13:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 10:27 [PATCH 6.6] thermal/of: Fix mask mismatch when no trips subnode Hsin-Te Yuan
2025-07-07 16:57 ` Rafael J. Wysocki
2025-07-08 6:40 ` Hsin-Te Yuan
2025-07-08 12:44 ` Rafael J. Wysocki
2025-07-10 13:33 ` Greg KH [this message]
2025-07-14 12:36 ` Hsin-Te Yuan
2025-07-14 13:04 ` Greg KH
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=2025071012-granola-daylong-9943@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=amitk@kernel.org \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=rui.zhang@intel.com \
--cc=stable@vger.kernel.org \
--cc=yuanhsinte@chromium.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