Просмотр исходного кода

usb: gadget: f_midi: fail if set_alt fails to allocate requests

This ensures that the midi function will only work if the proper number of
IN and OUT requrests are allocated. Otherwise the function will work with less
requests then what the user wants.

Signed-off-by: Felipe F. Tonello <eu@felipetonello.com>
Signed-off-by: Felipe Balbi <balbi@ti.com>
Felipe F. Tonello 9 лет назад
Родитель
Сommit
f0f1b8cac4
1 измененных файлов с 2 добавлено и 1 удалено
  1. 2 1
      drivers/usb/gadget/function/f_midi.c

+ 2 - 1
drivers/usb/gadget/function/f_midi.c

@@ -344,9 +344,10 @@ static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt)
 		req->complete = f_midi_complete;
 		req->complete = f_midi_complete;
 		err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);
 		err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC);
 		if (err) {
 		if (err) {
-			ERROR(midi, "%s queue req: %d\n",
+			ERROR(midi, "%s: couldn't enqueue request: %d\n",
 				    midi->out_ep->name, err);
 				    midi->out_ep->name, err);
 			free_ep_req(midi->out_ep, req);
 			free_ep_req(midi->out_ep, req);
+			return err;
 		}
 		}
 	}
 	}