[PATCH v2 4/5] fs: fat: simplify gotos from read_bootsectandvi
christian.taedcke-oss at weidmueller.com
christian.taedcke-oss at weidmueller.com
Fri Nov 10 10:42:14 CET 2023
From: Christian Taedcke <christian.taedcke at weidmueller.com>
This simplifies the code a little bit.
Signed-off-by: Christian Taedcke <christian.taedcke at weidmueller.com>
---
Changes in v2:
- Keep one goto label instead of removing both
- Move changing gotos from read_bootsectandvi() into separate commit
fs/fat/fat.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/fs/fat/fat.c b/fs/fat/fat.c
index c368c3b076..77f225ccd8 100644
--- a/fs/fat/fat.c
+++ b/fs/fat/fat.c
@@ -531,7 +531,8 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
if (disk_read(0, 1, block) < 0) {
debug("Error: reading block\n");
- goto fail;
+ ret = -1;
+ goto out_free;
}
memcpy(bs, block, sizeof(boot_sector));
@@ -556,10 +557,8 @@ read_bootsectandvi(boot_sector *bs, volume_info *volinfo, int *fatsize)
*fatsize = determine_legacy_fat_bits(bs);
}
memcpy(volinfo, vistart, sizeof(volume_info));
- goto exit;
-fail:
- ret = -1;
-exit:
+
+out_free:
free(block);
return ret;
}
--
2.34.1
More information about the U-Boot
mailing list