[PATCH 1/2] usb: gadget: print a meaningful error message

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



We can only register one USB multi gadget, so check for it being
already registered and print a meaningful error message if it is.

Signed-off-by: Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>
---
 drivers/usb/gadget/multi.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/usb/gadget/multi.c b/drivers/usb/gadget/multi.c
index 13fa622f01..a2cfc8d850 100644
--- a/drivers/usb/gadget/multi.c
+++ b/drivers/usb/gadget/multi.c
@@ -234,6 +234,11 @@ static struct usb_composite_driver multi_driver = {
 
 int usb_multi_register(struct f_multi_opts *opts)
 {
+	if (gadget_multi_opts) {
+		pr_err("USB multi gadget already registered\n");
+		return -EBUSY;
+	}
+
 	gadget_multi_opts = opts;
 
 	return usb_composite_probe(&multi_driver);
-- 
2.11.0


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux