]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
xfs: Remove redundant NULL check after __GFP_NOFAIL
authorhongao <hongao@uniontech.com>
Mon, 23 Mar 2026 18:33:18 +0000 (11:33 -0700)
committerAndrey Albershteyn <aalbersh@kernel.org>
Wed, 8 Apr 2026 19:39:57 +0000 (21:39 +0200)
Source kernel commit: 281cb17787d4284a7790b9cbd80fded826ca7739

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>
libxfs/xfs_da_btree.c

index 969bfc9dee909da22db3d816a84c10bfb04d0b98..2fce657af5d0b66513416719db073025d0095370 100644 (file)
@@ -2712,12 +2712,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),
-                               GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
-               if (!map) {
-                       error = -ENOMEM;
-                       goto out_free_irecs;
-               }
+               map = kcalloc(nirecs, sizeof(struct xfs_buf_map),
+                             GFP_KERNEL | __GFP_NOLOCKDEP | __GFP_NOFAIL);
                *mapp = map;
        }