]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: Remove redundant NULL check after __GFP_NOFAIL
authorhongao <hongao@uniontech.com>
Wed, 4 Mar 2026 11:29:14 +0000 (19:29 +0800)
committerCarlos Maiolino <cem@kernel.org>
Thu, 5 Mar 2026 09:02:45 +0000 (10:02 +0100)
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>
fs/xfs/libxfs/xfs_da_btree.c

index 766631f0562e15def1da1ee729b079f0e03591b9..09d4c17b3e7ba2235c60cb3edc71c668cba32d6f 100644 (file)
@@ -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),
-                               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;
        }