File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
drivers/usb/gadget/function Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -88,7 +88,7 @@ static const struct snd_pcm_hardware uac_pcm_hardware = {
8888static void u_audio_iso_complete (struct usb_ep * ep , struct usb_request * req )
8989{
9090 unsigned pending ;
91- unsigned long flags ;
91+ unsigned long flags , flags2 ;
9292 unsigned int hw_ptr ;
9393 int status = req -> status ;
9494 struct uac_req * ur = req -> context ;
@@ -115,7 +115,14 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
115115 if (!substream )
116116 goto exit ;
117117
118+ snd_pcm_stream_lock_irqsave (substream , flags2 );
119+
118120 runtime = substream -> runtime ;
121+ if (!runtime || !snd_pcm_running (substream )) {
122+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
123+ goto exit ;
124+ }
125+
119126 spin_lock_irqsave (& prm -> lock , flags );
120127
121128 if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ) {
@@ -174,6 +181,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
174181 prm -> hw_ptr = (hw_ptr + req -> actual ) % runtime -> dma_bytes ;
175182 hw_ptr = prm -> hw_ptr ;
176183 spin_unlock_irqrestore (& prm -> lock , flags );
184+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
177185
178186 if ((hw_ptr % snd_pcm_lib_period_bytes (substream )) < req -> actual )
179187 snd_pcm_period_elapsed (substream );
You can’t perform that action at this time.
0 commit comments