We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6237390 commit 83e30f2Copy full SHA for 83e30f2
drivers/usb/gadget/legacy/raw_gadget.c
@@ -310,13 +310,15 @@ static int gadget_bind(struct usb_gadget *gadget,
310
dev->eps_num = i;
311
spin_unlock_irqrestore(&dev->lock, flags);
312
313
- /* Matches kref_put() in gadget_unbind(). */
314
- kref_get(&dev->count);
315
-
316
ret = raw_queue_event(dev, USB_RAW_EVENT_CONNECT, 0, NULL);
317
- if (ret < 0)
+ if (ret < 0) {
318
dev_err(&gadget->dev, "failed to queue event\n");
+ set_gadget_data(gadget, NULL);
+ return ret;
+ }
319
320
+ /* Matches kref_put() in gadget_unbind(). */
321
+ kref_get(&dev->count);
322
return ret;
323
}
324
0 commit comments