public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: vme_user: drop dead NULL checks inside list_for_each_entry()
@ 2026-05-06 14:48 Stepan Ionichev
  0 siblings, 0 replies; only message in thread
From: Stepan Ionichev @ 2026-05-06 14:48 UTC (permalink / raw)
  To: gregkh; +Cc: linux-staging, linux-kernel, Stepan Ionichev

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-05-06 14:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-06 14:48 [PATCH] staging: vme_user: drop dead NULL checks inside list_for_each_entry() Stepan Ionichev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox