]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
thunderbolt: Fix property read in nhi_wake_supported()
authorKonrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Mon, 9 Mar 2026 09:39:49 +0000 (10:39 +0100)
committerMika Westerberg <mika.westerberg@linux.intel.com>
Mon, 9 Mar 2026 11:36:54 +0000 (12:36 +0100)
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.

Fixes: 3cdb9446a117 ("thunderbolt: Add support for Intel Ice Lake")
Cc: stable@vger.kernel.org
Signed-off-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
drivers/thunderbolt/nhi.c

index ccce020a2432fb08221949f5e9c93b3727fe9b6b..2bb2e79ca3cb35df1565c35ad22c0f52a41454f9 100644 (file)
@@ -1020,7 +1020,7 @@ static bool nhi_wake_supported(struct pci_dev *pdev)
         * If power rails are sustainable for wakeup from S4 this
         * property is set by the BIOS.
         */
-       if (device_property_read_u8(&pdev->dev, "WAKE_SUPPORTED", &val))
+       if (!device_property_read_u8(&pdev->dev, "WAKE_SUPPORTED", &val))
                return !!val;
 
        return true;