[PATCH] blk: host_dev: Fix error code in host_sb_attach_file()

Dan Carpenter dan.carpenter at linaro.org
Wed Jan 31 08:09:52 CET 2024


This error path should return -EINVAL instead of success.

Fixes: e261fbf34785 ("blk: host_dev: Sanity check on the size of host backing file")
Signed-off-by: Dan Carpenter <dan.carpenter at linaro.org>
---
 drivers/block/host_dev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/block/host_dev.c b/drivers/block/host_dev.c
index 30c74157934a..52313435a0cb 100644
--- a/drivers/block/host_dev.c
+++ b/drivers/block/host_dev.c
@@ -61,6 +61,7 @@ static int host_sb_attach_file(struct udevice *dev, const char *filename)
 	if (size % desc->blksz) {
 		printf("The size of host backing file '%s' is not multiple of "
 		       "the device block size\n", filename);
+		ret = -EINVAL;
 		goto err_fname;
 	}
 	desc->lba = size / desc->blksz;
-- 
2.43.0



More information about the U-Boot mailing list