mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <>
Cc: Ahmad Fatoum <>
Subject: [PATCH master 2/6] usb: gadget: don't register UMS with empty function
Date: Sat, 19 Mar 2022 12:02:42 +0100	[thread overview]
Message-ID: <> (raw)
In-Reply-To: <>

system_partitions_get clones the system partitions and passes it along.
DFU and Fastboot use system partitions as a fallback and pass along a
NULL file list if they are empty. This enables e.g. usbgadget -A '' to
work: No files are expored, but fastboot OEM commands are possible.

USB mass storage though does pass along an empty system partitions file
list instead of NULL, which leads to bind failure, because UMS gadget
refuses to bind with no LUNs. Detect this case.

Fixes: 57313f83e83e ("usbgadget: add support for USB mass storage gadget")
Signed-off-by: Ahmad Fatoum <>
 common/usbgadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/usbgadget.c b/common/usbgadget.c
index 92e486199556..2ec6d9226cca 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -52,7 +52,7 @@ int usbgadget_register(const struct usbgadget_funcs *funcs)
 		opts->ums_opts.files = file_list_parse_null(funcs->ums_opts);
 		if (IS_ENABLED(CONFIG_USB_GADGET_MASS_STORAGE) && file_list_empty(opts->ums_opts.files)) {
-			opts->ums_opts.files = system_partitions_get();
+			opts->ums_opts.files = system_partitions_get_null();

barebox mailing list

  parent reply	other threads:[~2022-03-19 11:04 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-19 11:02 [PATCH master 0/6] usb: gadget: multi: fix bind error path Ahmad Fatoum
2022-03-19 11:02 ` [PATCH master 1/6] usb: gadget: implement and use system_partitions_get_null Ahmad Fatoum
2022-03-19 11:02 ` Ahmad Fatoum [this message]
2022-03-19 11:02 ` [PATCH master 3/6] usb: gadget: mass-storage: fix clean up of file descriptors Ahmad Fatoum
2022-03-19 11:02 ` [PATCH master 4/6] usb: gadget: mass-storage: reference count allocations used in bthread Ahmad Fatoum
2022-03-19 11:02 ` [PATCH master 5/6] usb: gadget: multi: fix broken handling of USB function bind error Ahmad Fatoum
2022-03-19 11:02 ` [PATCH master 6/6] usb: gadget: multi: free UMS instance at multi_unbind time Ahmad Fatoum
2022-03-28  8:53 ` [PATCH master 0/6] usb: gadget: multi: fix bind error path Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox