From 1e86296f7f1079b70c583a917d0c24cd02f77491 Mon Sep 17 00:00:00 2001
From: Sean Anderson <seanga2@gmail.com>
Date: Wed, 8 Nov 2023 11:48:33 -0500
Subject: [PATCH] spl: blk_fs: Fix uninitialized return value when we can't get
 a blk_desc

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 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/spl/spl_blk_fs.c b/common/spl/spl_blk_fs.c
index 63825d620d..144c8a65b5 100644
--- a/common/spl/spl_blk_fs.c
+++ b/common/spl/spl_blk_fs.c
@@ -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) {
-- 
2.39.5