]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
spl: blk_fs: Fix uninitialized return value when we can't get a blk_desc
authorSean Anderson <seanga2@gmail.com>
Wed, 8 Nov 2023 16:48:33 +0000 (11:48 -0500)
committerTom Rini <trini@konsulko.com>
Thu, 16 Nov 2023 18:49:13 +0000 (13:49 -0500)
Initialize ret to avoid returning garbage if blk_get_devnum_by_uclass_id
fails.

Fixes: 8ce6a2e1757 ("spl: blk: Support loading images from fs")
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
common/spl/spl_blk_fs.c

index 63825d620d11a456f72503d52fd00b83c5d87bd7..144c8a65b5dde5fb9bfc1770bdfd3d1162785f5c 100644 (file)
@@ -50,7 +50,7 @@ int spl_blk_load_image(struct spl_image_info *spl_image,
        struct blk_desc *blk_desc;
        loff_t actlen, filesize;
        struct blk_dev dev;
-       int ret;
+       int ret = -ENODEV;
 
        blk_desc = blk_get_devnum_by_uclass_id(uclass_id, devnum);
        if (!blk_desc) {