Skip to contentSkip to conversation

um: vector: Remove unnecessary NULL check in destroy_queue()

PATCH In review Tiwei Bie 2 participants 2 messages Apr 11 User-mode Linux (UML)

lore
Share & tools
lore

Tiwei Bie

author
#0 lore raw

PATCH 1/1 um: vector: Remove unnecessary NULL check in destroy_queue()

All callers of destroy_queue() already perform a NULL check, so a NULL qi will never be passed in. Inside destroy_queue(), we dereference qi immediately, and the subsequent NULL check on qi is unnecessary and confusing. Remove it to address the smatch warning.

---
 arch/um/drivers/vector_kern.c | 2 --
 1 file changed, 2 deletions(-)
arch/um/drivers/vector_kern.c +0 -2
index 2cc90055499a..755d936e5b43 100644
@@ -471,8 +471,6 @@ static void destroy_queue(struct vector_queue *qi)
 	struct vector_private *vp = netdev_priv(qi->dev);
 	struct mmsghdr *mmsg_vector;
 
-	if (qi == NULL)
-		return;
 	/* deallocate any skbuffs - we rely on any unused to be
 	 * set to NULL.
 	 */
Signature · 1 line
2.34.1
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 19 lines · Tiwei Bie

All callers of destroy_queue() already perform a NULL check, so a NULL qi will never be passed in. Inside destroy_queue(), we dereference qi immediately, and the subsequent NULL check on qi is unnecessary and confusing. Remove it to address the smatch warning.

---
  arch/um/drivers/vector_kern.c | 2 --
  1 file changed, 2 deletions(-)
arch/um/drivers/vector_kern.c +0 -0
index 2cc90055499a..755d936e5b43 100644

arch/um/drivers/vector_kern.c static void destroy_queue(struct vector_queue *qi) · line 476

Quoted 8 lines
arch/um/drivers/vector_kern.c +0 -2
@@ -471,8 +471,6 @@ static void destroy_queue(struct vector_queue *qi)
  	struct vector_private *vp = netdev_priv(qi->dev);
  	struct mmsghdr *mmsg_vector;
 
-	if (qi == NULL)
-		return;
  	/* deallocate any skbuffs - we rely on any unused to be
  	 * set to NULL.
  	 */
Signature · 2 lines
Anton R. Ivanov
Cambridgegreys Limited. Registered in England. Company Number 10273661