[PATCH] Invalidate cached FAT device upon boot error
    Prasad Kale 
    prasad.kale at live.com
       
    Thu Oct 30 18:03:01 CET 2025
    
    
  
When spl boot device list has multiple FAT devices, any previousely
registered FAT device should be deregistered before registering
next FAT boot device, otherwise the function may not attempt boot
from next FAT device.One of the situations where this issue can be
observed is when the boot device list has two FAT partitions of a
memory device and if booting fails on first partition (because of
file or partition related errors), boot from next partition actually
gets attempted on previous boot device only, as the previous device
has remained marked as registered. Call the function that invalidates
cached boot device in case of failure in booting from current FAT
boot device.
Signed-off-by: Prasad Kale <prasad.kale at live.com>
Cc: Dan Murphy <dmurphy at ti.com>
Cc: Sean Anderson <seanga2 at gmail.com>
---
 common/spl/spl_fat.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/common/spl/spl_fat.c b/common/spl/spl_fat.c
index e9ee5487d6e..8b1d01cff4b 100644
--- a/common/spl/spl_fat.c
+++ b/common/spl/spl_fat.c
@@ -96,9 +96,11 @@ int spl_load_image_fat(struct spl_image_info *spl_image,
 	err = spl_load(spl_image, bootdev, &load, size, 0);
 
 end:
-	if (err < 0)
+	if (err < 0) {
+		spl_fat_force_reregister();
 		printf("%s: error reading image %s, err - %d\n",
 		       __func__, filename, err);
+	}
 
 	return err;
 }
-- 
2.43.0
base-commit: e34d01d23e45e007368685ffa6dfd674b6dd7b17
branch: master
    
    
More information about the U-Boot
mailing list