[PATCH V3 2/2] erofs: refactor read_inode calling convention

Yiyang Wu toolmanp at tlmp.cc
Mon Sep 2 18:25:52 AEST 2024


On Mon, Sep 02, 2024 at 04:12:31PM GMT, Gao Xiang wrote:
> 
> 
> > +static int erofs_read_inode(struct inode *inode)
> >   {
> >   	struct super_block *sb = inode->i_sb;
> >   	struct erofs_sb_info *sbi = EROFS_SB(sb);
> > @@ -20,20 +45,21 @@ static void *erofs_read_inode(struct erofs_buf *buf,
> >   	struct erofs_inode_compact *dic;
> >   	struct erofs_inode_extended *die, *copied = NULL;
> >   	union erofs_inode_i_u iu;
> > -	unsigned int ifmt;
> > -	int err;
> > +	struct erofs_buf buf;
> 
> Should be
> 	struct erofs_buf buf = __EROFS_BUF_INITIALIZER;
> 
> Otherwise buf itself will be left uninitialized.
> 

My bad, i forget this when rebasing. will be fixed in next version.

> >   		inode_nohighmem(inode);
> >   		break;
> >   	case S_IFCHR:
> > @@ -269,7 +266,6 @@ static int erofs_fill_inode(struct inode *inode)
> >   #endif
> >   	}
> >   out_unlock:
> 
> I mean since `return err` is the only useful statement for
> label `out_unlock`.
> 
> You could just remove it entirely and replace all
> `goto out_unlock` to `return err`;
> 
> the name `out_unlock` itself is also meaningless due to
> this patch.
> 
> Thanks,
> Gao Xiang
> 
> > -	erofs_put_metabuf(&buf);
> >   	return err;
> >   }
> 
Got it, will be fixed in next version.

Best Regards,
Yiyang Wu


More information about the Linux-erofs mailing list