diff mbox series

btrfs: use PTR_ERR() instead of PTR_ERR_OR_ZERO() for btrfs_get_extent()

Message ID 1453d9d1513fa03098f5bf4d2fbecb29f7fd1332.1732488201.git.wqu@suse.com (mailing list archive)
State New
Headers show
Series btrfs: use PTR_ERR() instead of PTR_ERR_OR_ZERO() for btrfs_get_extent() | expand

Commit Message

Qu Wenruo Nov. 24, 2024, 10:43 p.m. UTC
The function btrfs_get_extent() will only return an PTR_ERR() or a valid
extent map pointer. It will not return NULL.

Thus the usage of PTR_ERR_OR_ZERO() inside submit_one_sector() is not
needed, use plain PTR_ERR() instead, and that is the only usage of
PTR_ERR_OR_ZERO() after btrfs_get_extent().

Signed-off-by: Qu Wenruo <wqu@suse.com>
---
 fs/btrfs/extent_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Thumshirn Nov. 25, 2024, 6:54 a.m. UTC | #1
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff mbox series

Patch

diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
index e629d2ee152a..438974d4def4 100644
--- a/fs/btrfs/extent_io.c
+++ b/fs/btrfs/extent_io.c
@@ -1335,7 +1335,7 @@  static int submit_one_sector(struct btrfs_inode *inode,
 
 	em = btrfs_get_extent(inode, NULL, filepos, sectorsize);
 	if (IS_ERR(em))
-		return PTR_ERR_OR_ZERO(em);
+		return PTR_ERR(em);
 
 	extent_offset = filepos - em->start;
 	em_end = extent_map_end(em);