summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2022-03-19 12:02:42 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2022-03-28 10:52:55 +0200
commit8c69cd7528f10ff34c5ec5f204cb5cfddf3c6d71 (patch)
tree8e761a7fd3f8cd48e9e2a4ba46fc784fff36fa0d /common
parenta19926ae60d8cc43d400c0cb3a73875bd98bcdd8 (diff)
downloadbarebox-8c69cd7528f10ff34c5ec5f204cb5cfddf3c6d71.tar.gz
barebox-8c69cd7528f10ff34c5ec5f204cb5cfddf3c6d71.tar.xz
usb: gadget: don't register UMS with empty function
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 <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20220319110246.2850396-3-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/usbgadget.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/common/usbgadget.c b/common/usbgadget.c
index 92e4861995..2ec6d9226c 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)) {
file_list_free(opts->ums_opts.files);
- opts->ums_opts.files = system_partitions_get();
+ opts->ums_opts.files = system_partitions_get_null();
}
}