From: Mark A. Greer Date: Tue, 25 Mar 2014 15:54:30 +0000 (-0700) Subject: NFC: trf7970a: Only abort a command if one is active X-Git-Tag: next-20140530~73^2~60^2~38 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=5876bc75e2d3174cd1cd944ee33edc77cd1173ca;p=karo-tx-linux.git NFC: trf7970a: Only abort a command if one is active Only initiate the abort command process when there is an active command. If the abort process were started and there wasn't an active command then the next command issued by the digital layer would be incorrectly aborted. Signed-off-by: Mark A. Greer Signed-off-by: Samuel Ortiz --- diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c index 9c93fbef4964..cab302ce2c7e 100644 --- a/drivers/nfc/trf7970a.c +++ b/drivers/nfc/trf7970a.c @@ -1191,7 +1191,18 @@ static void trf7970a_abort_cmd(struct nfc_digital_dev *ddev) dev_dbg(trf->dev, "Abort process initiated\n"); mutex_lock(&trf->lock); - trf->aborting = true; + + switch (trf->state) { + case TRF7970A_ST_WAIT_FOR_TX_FIFO: + case TRF7970A_ST_WAIT_FOR_RX_DATA: + case TRF7970A_ST_WAIT_FOR_RX_DATA_CONT: + case TRF7970A_ST_WAIT_TO_ISSUE_EOF: + trf->aborting = true; + break; + default: + break; + } + mutex_unlock(&trf->lock); }