]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ocfs2: remove unnecessary NULL check in ocfs2_grab_folios()
authorDan Carpenter <dan.carpenter@linaro.org>
Tue, 19 Aug 2025 09:41:51 +0000 (12:41 +0300)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 14 Sep 2025 00:32:49 +0000 (17:32 -0700)
Smatch complains that checking "folios" for NULL doesn't make sense
because it has already been dereferenced at this point.  Really passing a
NULL "folios" pointer to ocfs2_grab_folios() doesn't make sense, and
fortunately none of the callers do that.  Delete the unnecessary NULL
check.

Link: https://lkml.kernel.org/r/aKRG39hyvDJcN2G7@stanley.mountain
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
Acked-by: Joseph Qi <joseph.qi@linux.alibaba.com>
Reviewed-by: Mark Tinguely <mark.tinguely@oracle.com>
Cc: Mark Fasheh <mark@fasheh.com>
Cc: Joel Becker <jlbec@evilplan.org>
Cc: Junxiao Bi <junxiao.bi@oracle.com>
Cc: Changwei Ge <gechangwei@live.cn>
Cc: Jun Piao <piaojun@huawei.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/ocfs2/alloc.c

index 821cb7874685e166e258b9f6e8c497bd33aca86d..162711cc5b201f2a361dd08933464915c37ecbb8 100644 (file)
@@ -6928,8 +6928,7 @@ static int ocfs2_grab_folios(struct inode *inode, loff_t start, loff_t end,
 
 out:
        if (ret != 0) {
-               if (folios)
-                       ocfs2_unlock_and_free_folios(folios, numfolios);
+               ocfs2_unlock_and_free_folios(folios, numfolios);
                numfolios = 0;
        }