From: Markus Elfring Date: Tue, 3 Sep 2019 13:10:05 +0000 (+0200) Subject: gfs2: Delete an unnecessary check before brelse() X-Git-Tag: v5.15~5456^2~5 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bccaef90738581038ee609e946f36812bd6fb1b3;p=platform%2Fkernel%2Flinux-starfive.git gfs2: Delete an unnecessary check before brelse() The brelse() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. [The same applies to brelse() in gfs2_dir_no_add (which Coccinelle apparently missed), so fix that as well.] Signed-off-by: Markus Elfring Signed-off-by: Andreas Gruenbacher --- diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c index 6f35d19..eb9c057 100644 --- a/fs/gfs2/dir.c +++ b/fs/gfs2/dir.c @@ -1463,8 +1463,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx, sort_offset : entries, copied); out_free: for(i = 0; i < leaf; i++) - if (larr[i]) - brelse(larr[i]); + brelse(larr[i]); kvfree(larr); out: return error; diff --git a/fs/gfs2/dir.h b/fs/gfs2/dir.h index 0ac2dc8..5b76480 100644 --- a/fs/gfs2/dir.h +++ b/fs/gfs2/dir.h @@ -32,8 +32,7 @@ extern int gfs2_dir_add(struct inode *inode, const struct qstr *filename, const struct gfs2_inode *ip, struct gfs2_diradd *da); static inline void gfs2_dir_no_add(struct gfs2_diradd *da) { - if (da->bh) - brelse(da->bh); + brelse(da->bh); da->bh = NULL; } extern int gfs2_dir_del(struct gfs2_inode *dip, const struct dentry *dentry);