Skip to content

Commit 281cb17

Browse files
hongaoocmaiolino
authored andcommitted
xfs: Remove redundant NULL check after __GFP_NOFAIL
kzalloc() is called with __GFP_NOFAIL, so a NULL return is not expected. Drop the redundant !map check in xfs_dabuf_map(). Also switch the nirecs-sized allocation to kcalloc(). Signed-off-by: hongao <hongao@uniontech.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
1 parent 0ca1a83 commit 281cb17

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

fs/xfs/libxfs/xfs_da_btree.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2716,12 +2716,8 @@ xfs_dabuf_map(
27162716
* larger one that needs to be free by the caller.
27172717
*/
27182718
if (nirecs > 1) {
2719-
map = kzalloc(nirecs * sizeof(struct xfs_buf_map),
2720-
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
2721-
if (!map) {
2722-
error = -ENOMEM;
2723-
goto out_free_irecs;
2724-
}
2719+
map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
2720+
GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
27252721
*mapp = map;
27262722
}
27272723

0 commit comments

Comments
 (0)