bcachefs: Removes NULL pointer checks for __filemap_get_folio return values
authorYouling Tang <tangyouling@kylinos.cn>
Tue, 24 Sep 2024 02:53:50 +0000 (10:53 +0800)
committerKent Overstreet <kent.overstreet@linux.dev>
Sat, 21 Dec 2024 06:36:17 +0000 (01:36 -0500)
__filemap_get_folio the return value cannot be NULL, so unnecessary checks
are removed.

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/fs-io-buffered.c
fs/bcachefs/fs-io-pagecache.c
fs/bcachefs/fs-io.c

index 0923f38a2fcd23143121795dd04c6a388967fd6e..b853cecd3c1b965f53537bf6ff5b31be72b3cb3d 100644 (file)
@@ -686,7 +686,7 @@ int bch2_write_begin(struct file *file, struct address_space *mapping,
        folio = __filemap_get_folio(mapping, pos >> PAGE_SHIFT,
                                    FGP_WRITEBEGIN | fgf_set_order(len),
                                    mapping_gfp_mask(mapping));
-       if (IS_ERR_OR_NULL(folio))
+       if (IS_ERR(folio))
                goto err_unlock;
 
        offset = pos - folio_pos(folio);
index 51a499c5a7b6467a443e1ace32c0b07a17c2fec1..e072900e6a5b9eb11ca21b62ac95766181401242 100644 (file)
@@ -29,7 +29,7 @@ int bch2_filemap_get_contig_folios_d(struct address_space *mapping,
                        break;
 
                f = __filemap_get_folio(mapping, pos >> PAGE_SHIFT, fgp_flags, gfp);
-               if (IS_ERR_OR_NULL(f))
+               if (IS_ERR(f))
                        break;
 
                BUG_ON(fs->nr && folio_pos(f) != pos);
index 0021db19148070865966701e71e8a0d6513c50ae..c6fdfec510823c6ffb8e1df999680fc99c5da5f8 100644 (file)
@@ -256,7 +256,7 @@ static int __bch2_truncate_folio(struct bch_inode_info *inode,
 
                folio = __filemap_get_folio(mapping, index,
                                            FGP_LOCK|FGP_CREAT, GFP_KERNEL);
-               if (IS_ERR_OR_NULL(folio)) {
+               if (IS_ERR(folio)) {
                        ret = -ENOMEM;
                        goto out;
                }