[PATCH] dfu: Call backend specific dfu_fill_*() only if enabled

Marek Vasut marex at denx.de
Mon Nov 28 20:39:17 CET 2022


The dfu_fill_*() functions are available only if the matching backend is
enabled. Add missing CONFIG_IS_ENABLED() guard for each backend to prevent
build errors, in case such a backend is enabled in U-Boot and not in SPL
or vice versa.

Signed-off-by: Marek Vasut <marex at denx.de>
---
Cc: Lukasz Majewski <lukma at denx.de>
Cc: Patrice Chotard <patrice.chotard at foss.st.com>
Cc: Patrick Delaunay <patrick.delaunay at foss.st.com>
---
 drivers/dfu/dfu.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
index 516dda61796..f9679d5ee52 100644
--- a/drivers/dfu/dfu.c
+++ b/drivers/dfu/dfu.c
@@ -529,22 +529,22 @@ static int dfu_fill_entity(struct dfu_entity *dfu, char *s, int alt,
 	dfu->free_entity = NULL;
 
 	/* Specific for mmc device */
-	if (strcmp(interface, "mmc") == 0) {
+	if (CONFIG_IS_ENABLED(DFU_MMC) && !strcmp(interface, "mmc")) {
 		if (dfu_fill_entity_mmc(dfu, devstr, argv, argc))
 			return -1;
-	} else if (strcmp(interface, "mtd") == 0) {
+	} else if (CONFIG_IS_ENABLED(DFU_MTD) && !strcmp(interface, "mtd")) {
 		if (dfu_fill_entity_mtd(dfu, devstr, argv, argc))
 			return -1;
-	} else if (strcmp(interface, "nand") == 0) {
+	} else if (CONFIG_IS_ENABLED(DFU_NAND) && !strcmp(interface, "nand")) {
 		if (dfu_fill_entity_nand(dfu, devstr, argv, argc))
 			return -1;
-	} else if (strcmp(interface, "ram") == 0) {
+	} else if (CONFIG_IS_ENABLED(DFU_RAM) && !strcmp(interface, "ram")) {
 		if (dfu_fill_entity_ram(dfu, devstr, argv, argc))
 			return -1;
-	} else if (strcmp(interface, "sf") == 0) {
+	} else if (CONFIG_IS_ENABLED(DFU_SF) && !strcmp(interface, "sf")) {
 		if (dfu_fill_entity_sf(dfu, devstr, argv, argc))
 			return -1;
-	} else if (strcmp(interface, "virt") == 0) {
+	} else if (CONFIG_IS_ENABLED(DFU_VIRT) && !strcmp(interface, "virt")) {
 		if (dfu_fill_entity_virt(dfu, devstr, argv, argc))
 			return -1;
 	} else {
-- 
2.35.1



More information about the U-Boot mailing list