padata: get_next is never NULL
authorJason A. Donenfeld <Jason@zx2c4.com>
Wed, 12 Apr 2017 08:40:19 +0000 (10:40 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 27 May 2020 14:41:37 +0000 (16:41 +0200)
commit 69b348449bda0f9588737539cfe135774c9939a7 upstream.

Per Dan's static checker warning, the code that returns NULL was removed
in 2010, so this patch updates the comments and fixes the code
assumptions.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Acked-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Cc: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/padata.c

index 408f58c4565a41974b73f9b47967db8f9ab8cc8b..d36c6becc22f7fc1dad90b5dafb96ea4847cd340 100644 (file)
@@ -156,8 +156,6 @@ EXPORT_SYMBOL(padata_do_parallel);
  * A pointer to the control struct of the next object that needs
  * serialization, if present in one of the percpu reorder queues.
  *
- * NULL, if all percpu reorder queues are empty.
- *
  * -EINPROGRESS, if the next object that needs serialization will
  *  be parallel processed by another cpu and is not yet present in
  *  the cpu's reorder queue.
@@ -184,8 +182,6 @@ static struct padata_priv *padata_get_next(struct parallel_data *pd)
        cpu = padata_index_to_cpu(pd, next_index);
        next_queue = per_cpu_ptr(pd->pqueue, cpu);
 
-       padata = NULL;
-
        reorder = &next_queue->reorder;
 
        spin_lock(&reorder->lock);
@@ -237,12 +233,11 @@ static void padata_reorder(struct parallel_data *pd)
                padata = padata_get_next(pd);
 
                /*
-                * All reorder queues are empty, or the next object that needs
-                * serialization is parallel processed by another cpu and is
-                * still on it's way to the cpu's reorder queue, nothing to
-                * do for now.
+                * If the next object that needs serialization is parallel
+                * processed by another cpu and is still on it's way to the
+                * cpu's reorder queue, nothing to do for now.
                 */
-               if (!padata || PTR_ERR(padata) == -EINPROGRESS)
+               if (PTR_ERR(padata) == -EINPROGRESS)
                        break;
 
                /*