Re: [PATCH] thunderbolt: nhi: Don't act on random stack values

From: Mika Westerberg

Date: Mon Mar 09 2026 - 07:41:52 EST


On Mon, Mar 09, 2026 at 10:39:49AM +0100, Konrad Dybcio wrote:
> From: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>
>
> device_property_read_foo() returns 0 on success and only then modifies
> 'val'. Currently, val is left uninitialized if the aforementioned
> function returns non-zero, making nhi_wake_supported() return true
> almost always (random != 0) if the property is not present in device
> firmware.
>
> Invert the check to make it make sense.

Good catch!

> Note device_property_read_bool() would not be fitting here, as both
> 0 and (presumably) 1 seem to be acceptable values if the property is
> present at all.

I think all the systems out there just have this 1 which is why it has been
"working" so far.

> Fixes: 3cdb9446a117 ("thunderbolt: Add support for Intel Ice Lake")
> Signed-off-by: Konrad Dybcio <konrad.dybcio@xxxxxxxxxxxxxxxx>

Marked for stable and applied to thunderbolt.git/fixes, thanks!