crypto: ccp - Update the command queue on errors
authorGary R Hook <gary.hook@amd.com>
Thu, 9 Feb 2017 21:49:57 +0000 (15:49 -0600)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 15 Feb 2017 05:23:34 +0000 (13:23 +0800)
Move the command queue tail pointer when an error is
detected. Always return the error.

Signed-off-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
drivers/crypto/ccp/ccp-dev-v5.c

index e0dfb6a05c484ee4401e114d148b31cce3b0977e..41cc853f8569cfd4825806028331ed5d98f005c0 100644 (file)
@@ -250,17 +250,20 @@ static int ccp5_do_cmd(struct ccp5_desc *desc,
                ret = wait_event_interruptible(cmd_q->int_queue,
                                               cmd_q->int_rcvd);
                if (ret || cmd_q->cmd_error) {
+                       /* Log the error and flush the queue by
+                        * moving the head pointer
+                        */
                        if (cmd_q->cmd_error)
                                ccp_log_error(cmd_q->ccp,
                                              cmd_q->cmd_error);
-                       /* A version 5 device doesn't use Job IDs... */
+                       iowrite32(tail, cmd_q->reg_head_lo);
                        if (!ret)
                                ret = -EIO;
                }
                cmd_q->int_rcvd = 0;
        }
 
-       return 0;
+       return ret;
 }
 
 static int ccp5_perform_aes(struct ccp_op *op)