Skip to content
This repository
Browse code

Handle the case of failing URBs in hiface_pcm_out_urb_handler()

Signed-off-by: Antonio Ospite <ao2@amarulasolutions.com>
  • Loading branch information...
commit 0b7415e559e1a868240ac87a54ac805ca69fe4e7 1 parent 615c7ec
Antonio Ospite ao2 authored

Showing 1 changed file with 17 additions and 2 deletions. Show diff stats Hide diff stats

  1. +17 2 pcm.c
19 pcm.c
@@ -306,12 +306,20 @@ static void hiface_pcm_out_urb_handler(struct urb *usb_urb)
306 306 struct pcm_substream *sub;
307 307 bool do_period_elapsed = false;
308 308 unsigned long flags;
  309 + int ret;
309 310
310 311 pr_debug("%s: called.\n", __func__);
311 312
312   - if (usb_urb->status || rt->panic || rt->stream_state == STREAM_STOPPING)
  313 + if (rt->panic || rt->stream_state == STREAM_STOPPING)
313 314 return;
314 315
  316 + if (unlikely(usb_urb->status == -ENOENT || /* unlinked */
  317 + usb_urb->status == -ENODEV || /* device removed */
  318 + usb_urb->status == -ECONNRESET || /* unlinked */
  319 + usb_urb->status == -ESHUTDOWN)) { /* device disabled */
  320 + goto out_fail;
  321 + }
  322 +
315 323 if (rt->stream_state == STREAM_STARTING) {
316 324 rt->stream_wait_cond = true;
317 325 wake_up(&rt->stream_wait_queue);
@@ -330,7 +338,14 @@ static void hiface_pcm_out_urb_handler(struct urb *usb_urb)
330 338 if (do_period_elapsed)
331 339 snd_pcm_period_elapsed(sub->instance);
332 340
333   - usb_submit_urb(&out_urb->instance, GFP_ATOMIC);
  341 + ret = usb_submit_urb(&out_urb->instance, GFP_ATOMIC);
  342 + if (ret < 0)
  343 + goto out_fail;
  344 +
  345 + return;
  346 +
  347 +out_fail:
  348 + rt->panic = true;
334 349 }
335 350
336 351 static int hiface_pcm_open(struct snd_pcm_substream *alsa_sub)

0 comments on commit 0b7415e

Please sign in to comment.
Something went wrong with that request. Please try again.