Squashfs: move table allocation into squashfs_read_table()
This eliminates a lot of duplicate code. Signed-off-by: Phillip Lougher <phillip@lougher.demon.co.uk>
This commit is contained in:
@@ -124,27 +124,10 @@ __le64 *squashfs_read_inode_lookup_table(struct super_block *sb,
|
||||
u64 lookup_table_start, unsigned int inodes)
|
||||
{
|
||||
unsigned int length = SQUASHFS_LOOKUP_BLOCK_BYTES(inodes);
|
||||
__le64 *inode_lookup_table;
|
||||
int err;
|
||||
|
||||
TRACE("In read_inode_lookup_table, length %d\n", length);
|
||||
|
||||
/* Allocate inode lookup table indexes */
|
||||
inode_lookup_table = kmalloc(length, GFP_KERNEL);
|
||||
if (inode_lookup_table == NULL) {
|
||||
ERROR("Failed to allocate inode lookup table\n");
|
||||
return ERR_PTR(-ENOMEM);
|
||||
}
|
||||
|
||||
err = squashfs_read_table(sb, inode_lookup_table, lookup_table_start,
|
||||
length);
|
||||
if (err < 0) {
|
||||
ERROR("unable to read inode lookup table\n");
|
||||
kfree(inode_lookup_table);
|
||||
return ERR_PTR(err);
|
||||
}
|
||||
|
||||
return inode_lookup_table;
|
||||
return squashfs_read_table(sb, lookup_table_start, length);
|
||||
}
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user