[PATCH 1/3] bcachefs: Removes NULL pointer checks for filemap_lock_folio() return values

From: Youling Tang
Date: Thu Jun 26 2025 - 21:22:00 EST


From: Youling Tang <tangyouling@xxxxxxxxxx>

__filemap_get_folio the return value cannot be NULL, so unnecessary checks
are removed.

Signed-off-by: Youling Tang <tangyouling@xxxxxxxxxx>
---
fs/bcachefs/fs-io.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/bcachefs/fs-io.c b/fs/bcachefs/fs-io.c
index dc5f713e209c..74841b1dc8ca 100644
--- a/fs/bcachefs/fs-io.c
+++ b/fs/bcachefs/fs-io.c
@@ -289,7 +289,7 @@ static int __bch2_truncate_folio(struct bch_inode_info *inode,
u64 end_pos;

folio = filemap_lock_folio(mapping, index);
- if (IS_ERR_OR_NULL(folio)) {
+ if (IS_ERR(folio)) {
/*
* XXX: we're doing two index lookups when we end up reading the
* folio
--
2.34.1