Re: [PATCH] xfs: Remove redundant NULL check after __GFP_NOFAIL
From: Carlos Maiolino
Date: Wed Mar 04 2026 - 04:55:06 EST
On Tue, Mar 03, 2026 at 11:33:32AM +0800, hongao wrote:
> Remove redundant NULL check after kzalloc() with GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL.
>
> Signed-off-by: hongao <hongao@xxxxxxxxxxxxx>
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index 766631f0562e..f76dfc8f4e1a 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -2718,10 +2718,6 @@ xfs_dabuf_map(
> if (nirecs > 1) {
> map = kzalloc(nirecs * sizeof(struct xfs_buf_map),
> GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
> - if (!map) {
> - error = -ENOMEM;
> - goto out_free_irecs;
> - }
> *mapp = map;
> }
>
+1 for kcalloc.
feel free to add:
Reviewed-by: Carlos Maiolino <cmaiolino@xxxxxxxxxx>
> --
> 2.51.0
>
>