[PATCH] fixup! fastboot/dfu: use system partitions as fall back

Ahmad Fatoum a.fatoum at pengutronix.de
Mon May 3 05:30:19 PDT 2021


We need to maintain the check for whether dfu/fastboot is enabled,
otherwise usbgadget_register can't differentiate between disabled
gadget and gadget with default (empty string) function.

Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 common/usbgadget.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/common/usbgadget.c b/common/usbgadget.c
index b953f8bf771c..d4437b51694a 100644
--- a/common/usbgadget.c
+++ b/common/usbgadget.c
@@ -59,20 +59,23 @@ int usbgadget_register(bool dfu, const char *dfu_opts,
 	opts = xzalloc(sizeof(*opts));
 	opts->release = usb_multi_opts_release;
 
-	opts->dfu_opts.files = parse(dfu_opts);
-	if (IS_ENABLED(CONFIG_USB_GADGET_DFU) && file_list_empty(opts->dfu_opts.files)) {
-		file_list_free(opts->dfu_opts.files);
-		opts->dfu_opts.files = get_dfu_function();
+	if (dfu) {
+		opts->dfu_opts.files = parse(dfu_opts);
+		if (IS_ENABLED(CONFIG_USB_GADGET_DFU) && file_list_empty(opts->dfu_opts.files)) {
+			file_list_free(opts->dfu_opts.files);
+			opts->dfu_opts.files = get_dfu_function();
+		}
 	}
 
-	opts->fastboot_opts.files = parse(fastboot_opts);
-	if (IS_ENABLED(CONFIG_FASTBOOT_BASE) && file_list_empty(opts->fastboot_opts.files)) {
-		file_list_free(opts->fastboot_opts.files);
-		opts->fastboot_opts.files = get_fastboot_partitions();
-	}
+	if (fastboot) {
+		opts->fastboot_opts.files = parse(fastboot_opts);
+		if (IS_ENABLED(CONFIG_FASTBOOT_BASE) && file_list_empty(opts->fastboot_opts.files)) {
+			file_list_free(opts->fastboot_opts.files);
+			opts->fastboot_opts.files = get_fastboot_partitions();
+		}
 
-	if (fastboot)
 		opts->fastboot_opts.export_bbu = export_bbu;
+	}
 
 	opts->create_acm = acm;
 
-- 
2.29.2




More information about the barebox mailing list