mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-16 00:51:51 -04:00
thunderbolt: Fix property read in nhi_wake_supported()
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: 3cdb9446a1 ("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>
This commit is contained in:
committed by
Mika Westerberg
parent
1f318b96cc
commit
73a505dc48
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user