From: Stepan Ionichev <sozdayvek@gmail.com>
To: gregkh@linuxfoundation.org
Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org,
Stepan Ionichev <sozdayvek@gmail.com>
Subject: [PATCH] staging: vme_user: drop dead NULL checks inside list_for_each_entry()
Date: Wed, 6 May 2026 19:48:26 +0500 [thread overview]
Message-ID: <20260506144826.399-1-sozdayvek@gmail.com> (raw)
list_for_each_entry() walks list entries via container_of() on the
list head pointer; the iterator is never NULL during iteration. The
"if (!iter)" branches inside vme_slave_request(), vme_master_request(),
vme_dma_request() and vme_lm_request() are therefore unreachable.
smatch flags the inconsistency:
drivers/staging/vme_user/vme.c:266 vme_slave_request() error: we
previously assumed slave_image could be null (see line 267)
drivers/staging/vme_user/vme.c:460 vme_master_request() error: we
previously assumed master_image could be null (see line 461)
drivers/staging/vme_user/vme.c:834 vme_dma_request() error: we
previously assumed dma_ctrlr could be null (see line 835)
drivers/staging/vme_user/vme.c:1439 vme_lm_request() error: we
previously assumed lm could be null (see line 1440)
Drop the dead checks.
No functional change.
Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com>
---
drivers/staging/vme_user/vme.c | 24 ------------------------
1 file changed, 24 deletions(-)
diff --git a/drivers/staging/vme_user/vme.c b/drivers/staging/vme_user/vme.c
index 7220aba7b..ca6c43fb3 100644
--- a/drivers/staging/vme_user/vme.c
+++ b/drivers/staging/vme_user/vme.c
@@ -264,12 +264,6 @@ struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address,
/* Loop through slave resources */
list_for_each_entry(slave_image, &bridge->slave_resources, list) {
- if (!slave_image) {
- dev_err(bridge->parent,
- "Registered NULL Slave resource\n");
- continue;
- }
-
/* Find an unlocked and compatible image */
mutex_lock(&slave_image->mtx);
if (((slave_image->address_attr & address) == address) &&
@@ -458,12 +452,6 @@ struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address,
/* Loop through master resources */
list_for_each_entry(master_image, &bridge->master_resources, list) {
- if (!master_image) {
- dev_warn(bridge->parent,
- "Registered NULL master resource\n");
- continue;
- }
-
/* Find an unlocked and compatible image */
spin_lock(&master_image->lock);
if (((master_image->address_attr & address) == address) &&
@@ -832,12 +820,6 @@ struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route)
/* Loop through DMA resources */
list_for_each_entry(dma_ctrlr, &bridge->dma_resources, list) {
- if (!dma_ctrlr) {
- dev_err(bridge->parent,
- "Registered NULL DMA resource\n");
- continue;
- }
-
/* Find an unlocked and compatible controller */
mutex_lock(&dma_ctrlr->mtx);
if (((dma_ctrlr->route_attr & route) == route) &&
@@ -1437,12 +1419,6 @@ struct vme_resource *vme_lm_request(struct vme_dev *vdev)
/* Loop through LM resources */
list_for_each_entry(lm, &bridge->lm_resources, list) {
- if (!lm) {
- dev_err(bridge->parent,
- "Registered NULL Location Monitor resource\n");
- continue;
- }
-
/* Find an unlocked controller */
mutex_lock(&lm->mtx);
if (lm->locked == 0) {
--
2.43.0
reply other threads:[~2026-05-06 14:50 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20260506144826.399-1-sozdayvek@gmail.com \
--to=sozdayvek@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox