From: Gou Hao <gouhao@uniontech.com>
To: maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com,
chleroy@kernel.org, maarten.lankhorst@linux.intel.com,
mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com,
simona@ffwll.ch, bharat@chelsio.com, jgg@ziepe.ca,
leon@kernel.org, akpm@linux-foundation.org, ynorov@nvidia.com,
namcao@linutronix.de, mkchauras@gmail.com, sshegde@linux.ibm.com,
nilay@linux.ibm.com, kees@kernel.org
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
dri-devel@lists.freedesktop.org, linux-rdma@vger.kernel.org,
linux-mm@kvack.org, gouhaojake@163.com, kernel@uniontech.com
Subject: [PATCH 4/4] RDMA/cxgb4: remove dead NULL checks after GFP_NOFAIL allocations
Date: Thu, 23 Jul 2026 16:18:13 +0800 [thread overview]
Message-ID: <20260723081813.176792-5-gouhao@uniontech.com> (raw)
In-Reply-To: <20260723081813.176792-1-gouhao@uniontech.com>
alloc_skb() with the __GFP_NOFAIL flag will never return NULL,
so the subsequent NULL checks and error handling are unreachable
dead code. Remove them.
Signed-off-by: Gou Hao <gouhao@uniontech.com>
---
drivers/infiniband/hw/cxgb4/mem.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/infiniband/hw/cxgb4/mem.c b/drivers/infiniband/hw/cxgb4/mem.c
index cd1b01014198..08631de17c0a 100644
--- a/drivers/infiniband/hw/cxgb4/mem.c
+++ b/drivers/infiniband/hw/cxgb4/mem.c
@@ -74,11 +74,8 @@ static int _c4iw_write_mem_dma_aligned(struct c4iw_rdev *rdev, u32 addr,
c4iw_init_wr_wait(wr_waitp);
wr_len = roundup(sizeof(*req) + sizeof(*sgl), 16);
- if (!skb) {
+ if (!skb)
skb = alloc_skb(wr_len, GFP_KERNEL | __GFP_NOFAIL);
- if (!skb)
- return -ENOMEM;
- }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
req = __skb_put_zero(skb, wr_len);
@@ -134,11 +131,8 @@ static int _c4iw_write_mem_inline(struct c4iw_rdev *rdev, u32 addr, u32 len,
roundup(copy_len, T4_ULPTX_MIN_IO),
16);
- if (!skb) {
+ if (!skb)
skb = alloc_skb(wr_len, GFP_KERNEL | __GFP_NOFAIL);
- if (!skb)
- return -ENOMEM;
- }
set_wr_txq(skb, CPL_PRIORITY_CONTROL, 0);
req = __skb_put_zero(skb, wr_len);
--
2.20.1
next prev parent reply other threads:[~2026-07-23 8:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-23 8:18 [PATCH 0/4] remove dead NULL checks after GFP_NOFAIL allocations Gou Hao
2026-07-23 8:18 ` [PATCH 1/4] powerpc/xive: remove dead NULL check after GFP_NOFAIL allocation Gou Hao
2026-07-23 8:28 ` sashiko-bot
2026-07-23 9:37 ` Mukesh Kumar Chaurasiya
2026-07-23 10:26 ` Gou Hao
2026-07-23 8:18 ` [PATCH 2/4] drm: remove dead WARN_ON " Gou Hao
2026-07-23 8:18 ` [PATCH 3/4] lib/test_hmm: remove dead NULL checks after GFP_NOFAIL allocations Gou Hao
2026-07-23 8:29 ` sashiko-bot
2026-07-23 8:18 ` Gou Hao [this message]
2026-07-23 8:35 ` [PATCH 4/4] RDMA/cxgb4: " sashiko-bot
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260723081813.176792-5-gouhao@uniontech.com \
--to=gouhao@uniontech.com \
--cc=airlied@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bharat@chelsio.com \
--cc=chleroy@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=gouhaojake@163.com \
--cc=jgg@ziepe.ca \
--cc=kees@kernel.org \
--cc=kernel@uniontech.com \
--cc=leon@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=maddy@linux.ibm.com \
--cc=mkchauras@gmail.com \
--cc=mpe@ellerman.id.au \
--cc=mripard@kernel.org \
--cc=namcao@linutronix.de \
--cc=nilay@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=simona@ffwll.ch \
--cc=sshegde@linux.ibm.com \
--cc=tzimmermann@suse.de \
--cc=ynorov@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.