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 @@ -79,7 +79,7 @@ static const struct snd_pcm_hardware uac_pcm_hardware = {
7979static void u_audio_iso_complete (struct usb_ep * ep , struct usb_request * req )
8080{
8181 unsigned pending ;
82- unsigned long flags ;
82+ unsigned long flags , flags2 ;
8383 unsigned int hw_ptr ;
8484 int status = req -> status ;
8585 struct uac_req * ur = req -> context ;
@@ -106,7 +106,14 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
106106 if (!substream )
107107 goto exit ;
108108
109+ snd_pcm_stream_lock_irqsave (substream , flags2 );
110+
109111 runtime = substream -> runtime ;
112+ if (!runtime || !snd_pcm_running (substream )) {
113+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
114+ goto exit ;
115+ }
116+
110117 spin_lock_irqsave (& prm -> lock , flags );
111118
112119 if (substream -> stream == SNDRV_PCM_STREAM_PLAYBACK ) {
@@ -165,6 +172,7 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
165172 prm -> hw_ptr = (hw_ptr + req -> actual ) % runtime -> dma_bytes ;
166173 hw_ptr = prm -> hw_ptr ;
167174 spin_unlock_irqrestore (& prm -> lock , flags );
175+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
168176
169177 if ((hw_ptr % snd_pcm_lib_period_bytes (substream )) < req -> actual )
170178 snd_pcm_period_elapsed (substream );
You can’t perform that action at this time.
0 commit comments