File tree 1 file changed +9
-1
lines changed
drivers/usb/gadget/function 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 = {
79
79
static void u_audio_iso_complete (struct usb_ep * ep , struct usb_request * req )
80
80
{
81
81
unsigned pending ;
82
- unsigned long flags ;
82
+ unsigned long flags , flags2 ;
83
83
unsigned int hw_ptr ;
84
84
int status = req -> status ;
85
85
struct uac_req * ur = req -> context ;
@@ -106,7 +106,14 @@ static void u_audio_iso_complete(struct usb_ep *ep, struct usb_request *req)
106
106
if (!substream )
107
107
goto exit ;
108
108
109
+ snd_pcm_stream_lock_irqsave (substream , flags2 );
110
+
109
111
runtime = substream -> runtime ;
112
+ if (!runtime || !snd_pcm_running (substream )) {
113
+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
114
+ goto exit ;
115
+ }
116
+
110
117
spin_lock_irqsave (& prm -> lock , flags );
111
118
112
119
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)
165
172
prm -> hw_ptr = (hw_ptr + req -> actual ) % runtime -> dma_bytes ;
166
173
hw_ptr = prm -> hw_ptr ;
167
174
spin_unlock_irqrestore (& prm -> lock , flags );
175
+ snd_pcm_stream_unlock_irqrestore (substream , flags2 );
168
176
169
177
if ((hw_ptr % snd_pcm_lib_period_bytes (substream )) < req -> actual )
170
178
snd_pcm_period_elapsed (substream );
You can’t perform that action at this time.
0 commit comments