Skip to content

Commit 55ca3e7

Browse files
congwangLinus Torvalds
authored andcommitted
fs/romfs/inode.c: trivial improvements
- There are no lists in fs/romfs/inode.c, so using list_entry is a bit confusing. Replace it with container_of. - It is unnecessary to cast the return value of kmem_cache_alloc, since it returns a void* pointer. Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 0cbc591 commit 55ca3e7

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

‎fs/romfs/inode.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static inline unsigned long romfs_maxsize(struct super_block *sb)
9292

9393
static inline struct romfs_inode_info *ROMFS_I(struct inode *inode)
9494
{
95-
return list_entry(inode, struct romfs_inode_info, vfs_inode);
95+
return container_of(inode, struct romfs_inode_info, vfs_inode);
9696
}
9797

9898
static __u32
@@ -555,7 +555,7 @@ static struct kmem_cache * romfs_inode_cachep;
555555
static struct inode *romfs_alloc_inode(struct super_block *sb)
556556
{
557557
struct romfs_inode_info *ei;
558-
ei = (struct romfs_inode_info *)kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
558+
ei = kmem_cache_alloc(romfs_inode_cachep, GFP_KERNEL);
559559
if (!ei)
560560
return NULL;
561561
return &ei->vfs_inode;

0 commit comments

Comments
 (0)