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 = {
88
88
static void u_audio_iso_complete (struct usb_ep * ep , struct usb_request * req )
89
89
{
90
90
unsigned pending ;
91
- unsigned long flags ;
91
+ unsigned long flags , flags2 ;
92
92
unsigned int hw_ptr ;
93
93
int status = req -> status ;
94
94
struct uac_req * ur = req -> context ;
@@ -115,7 +115,14 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
115
115
if (!substream )
116
116
goto exit ;
117
117
118
+ snd_pcm_stream_lock_irqsave (substream , flags2 );
119
+
118
120
runtime = substream -> runtime ;
121
+ if (!runtime || !snd_pcm_running (substream )) {
122
+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
123
+ goto exit ;
124
+ }
125
+
119
126
spin_lock_irqsave (& prm -> lock , flags );
120
127
121
128
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)
174
181
prm -> hw_ptr = (hw_ptr + req -> actual ) % runtime -> dma_bytes ;
175
182
hw_ptr = prm -> hw_ptr ;
176
183
spin_unlock_irqrestore (& prm -> lock , flags );
184
+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
177
185
178
186
if ((hw_ptr % snd_pcm_lib_period_bytes (substream )) < req -> actual )
179
187
snd_pcm_period_elapsed (substream );
You can’t perform that action at this time.
0 commit comments