Skip to content

Commit 4891516

Browse files
Erickkaranjatiwai
authored andcommitted
ALSA: usb-audio: qcom: Adjust mutex unlock order
The mutexes qdev_mutex and chip->mutex are acquired in that order throughout the driver. To preserve proper lock hierarchy and avoid potential deadlocks, they must be released in the reverse order of acquisition. This change reorders the unlock sequence to first release chip->mutex followed by qdev_mutex, ensuring consistency with the locking pattern. [ fixed the code indentations and Fixes tag by tiwai ] Fixes: 326bbc3 ("ALSA: usb-audio: qcom: Introduce QC USB SND offloading support") Signed-off-by: Erick Karanja <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 9744ede commit 4891516

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sound/usb/qcom/qc_audio_offload.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -825,8 +825,8 @@ static int uaudio_sideband_notifier(struct usb_interface *intf,
825825
}
826826
}
827827

828-
mutex_unlock(&qdev_mutex);
829828
mutex_unlock(&chip->mutex);
829+
mutex_unlock(&qdev_mutex);
830830

831831
return 0;
832832
}
@@ -1865,8 +1865,8 @@ static void qc_usb_audio_offload_disconnect(struct snd_usb_audio *chip)
18651865

18661866
/* Device has already been cleaned up, or never populated */
18671867
if (!dev->chip) {
1868-
mutex_unlock(&qdev_mutex);
18691868
mutex_unlock(&chip->mutex);
1869+
mutex_unlock(&qdev_mutex);
18701870
return;
18711871
}
18721872

@@ -1921,8 +1921,8 @@ static void qc_usb_audio_offload_suspend(struct usb_interface *intf,
19211921

19221922
uaudio_send_disconnect_ind(chip);
19231923

1924-
mutex_unlock(&qdev_mutex);
19251924
mutex_unlock(&chip->mutex);
1925+
mutex_unlock(&qdev_mutex);
19261926
}
19271927

19281928
static struct snd_usb_platform_ops offload_ops = {

0 commit comments

Comments
 (0)