[PATCH] fs/squashfs/sqfs.c: use sqfs_read_sblk() in sqfs_probe()
Thomas Petazzoni
thomas.petazzoni at bootlin.com
Wed Jul 15 22:22:44 CEST 2020
sqfs_probe() currently duplicates what sqfs_read_sblk() is doing, so
use the latter in the former to avoid some small code duplication.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni at bootlin.com>
---
fs/squashfs/sqfs.c | 14 ++++----------
1 file changed, 4 insertions(+), 10 deletions(-)
diff --git a/fs/squashfs/sqfs.c b/fs/squashfs/sqfs.c
index 27f0b33a92..cd3fbade7e 100644
--- a/fs/squashfs/sqfs.c
+++ b/fs/squashfs/sqfs.c
@@ -1017,20 +1017,14 @@ int sqfs_readdir(struct fs_dir_stream *fs_dirs, struct fs_dirent **dentp)
int sqfs_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition)
{
struct squashfs_super_block *sblk;
+ int ret;
cur_dev = fs_dev_desc;
cur_part_info = *fs_partition;
- sblk = malloc_cache_aligned(cur_dev->blksz);
- if (!sblk)
- return -ENOMEM;
-
- /* Read SquashFS super block */
- if (sqfs_disk_read(0, 1, sblk) != 1) {
- free(sblk);
- cur_dev = NULL;
- return -EINVAL;
- }
+ ret = sqfs_read_sblk(&sblk);
+ if (ret)
+ return ret;
/* Make sure it has a valid SquashFS magic number*/
if (sblk->s_magic != SQFS_MAGIC_NUMBER) {
--
2.26.2
More information about the U-Boot
mailing list