Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

hongao and committed by
Carlos Maiolino
281cb177 0ca1a833

+2 -6
+2 -6
fs/xfs/libxfs/xfs_da_btree.c
··· 2716 2716 * larger one that needs to be free by the caller. 2717 2717 */ 2718 2718 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); 2725 2721 *mapp = map; 2726 2722 } 2727 2723