Commit 281cb177 authored by hongao's avatar hongao Committed by Carlos Maiolino
Browse files

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: default avatarhongao <hongao@uniontech.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarCarlos Maiolino <cem@kernel.org>
parent 0ca1a833
Loading
Loading
Loading
Loading
+2 −6
Original line number Diff line number Diff line
@@ -2716,12 +2716,8 @@ xfs_dabuf_map(
	 * larger one that needs to be free by the caller.
	 */
	if (nirecs > 1) {
		map = kzalloc(nirecs * sizeof(struct xfs_buf_map),
		map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
			      GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
		if (!map) {
			error = -ENOMEM;
			goto out_free_irecs;
		}
		*mapp = map;
	}