Skip to content

Commit 20aa8dc

Browse files
libinyangplbossart
authored andcommitted
ALSA: hda: intel-sdw-acpi: harden detection of controller
The existing code currently sets a pointer to an ACPI handle before checking that it's actually a SoundWire controller. This can lead to issues where the graph walk continues and eventually fails, but the pointer was set already. This patch changes the logic so that the information provided to the caller is set when a controller is found. Signed-off-by: Libin Yang <libin.yang@intel.com>
1 parent 25d4484 commit 20aa8dc

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

sound/hda/intel-sdw-acpi.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
132132
return AE_NOT_FOUND;
133133
}
134134

135-
info->handle = handle;
136-
137135
/*
138136
* On some Intel platforms, multiple children of the HDAS
139137
* device can be found, but only one of them is the SoundWire
@@ -144,6 +142,9 @@ static acpi_status sdw_intel_acpi_cb(acpi_handle handle, u32 level,
144142
if (FIELD_GET(GENMASK(31, 28), adr) != SDW_LINK_TYPE)
145143
return AE_OK; /* keep going */
146144

145+
/* found the correct SoundWire controller */
146+
info->handle = handle;
147+
147148
/* device found, stop namespace walk */
148149
return AE_CTRL_TERMINATE;
149150
}

0 commit comments

Comments
 (0)