]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
board: sandbox: Improve extension board scan implementation
authorKory Maincent (TI.com) <kory.maincent@bootlin.com>
Thu, 30 Oct 2025 16:45:06 +0000 (17:45 +0100)
committerTom Rini <trini@konsulko.com>
Mon, 3 Nov 2025 16:02:39 +0000 (10:02 -0600)
Enhance the extension board scanning code in sandbox with better error
handling and code organization.

Signed-off-by: Kory Maincent (TI.com) <kory.maincent@bootlin.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
board/sandbox/sandbox.c

index 0dc23a27dfc9f4580fcc8be33bcb054e7149c01f..c5d7b9651a97e2b01f06e041be4d5443f3b6a611 100644 (file)
@@ -113,11 +113,15 @@ int ft_board_setup(void *fdt, struct bd_info *bd)
 #ifdef CONFIG_CMD_EXTENSION
 int extension_board_scan(struct list_head *extension_list)
 {
-       struct extension *extension;
        int i;
 
        for (i = 0; i < 2; i++) {
+               struct extension *extension;
+
                extension = calloc(1, sizeof(struct extension));
+               if (!extension)
+                       return -ENOMEM;
+
                snprintf(extension->overlay, sizeof(extension->overlay), "overlay%d.dtbo", i);
                snprintf(extension->name, sizeof(extension->name), "extension board %d", i);
                snprintf(extension->owner, sizeof(extension->owner), "sandbox");