From: Mark A. Greer <mgreer@animalcreek.com>
Date: Tue, 2 Sep 2014 22:12:43 +0000 (-0700)
Subject: NFC: trf7970a: Cancel timer when error encountered
X-Git-Tag: firefly_0821_release~176^2~3001^2~75^2~80^2~38
X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6fb9edcb43d0b1bf0ac2aaf6ba488d105c45f477;p=firefly-linux-kernel-4.4.55.git

NFC: trf7970a: Cancel timer when error encountered

Some paths leave a timer still running when
trf7970a_send_err_upstream() is called.  This
can cause a timeout to occur in a subsequent
transaction making it fail.  Fix this by ensuring
there is no timer running before sending an error
upstream.

Signed-off-by: Mark A. Greer <mgreer@animalcreek.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
---

diff --git a/drivers/nfc/trf7970a.c b/drivers/nfc/trf7970a.c
index 0f09278ec37a..00fb2cee6790 100644
--- a/drivers/nfc/trf7970a.c
+++ b/drivers/nfc/trf7970a.c
@@ -506,6 +506,8 @@ static void trf7970a_send_err_upstream(struct trf7970a *trf, int errno)
 {
 	dev_dbg(trf->dev, "Error - state: %d, errno: %d\n", trf->state, errno);
 
+	cancel_delayed_work(&trf->timeout_work);
+
 	kfree_skb(trf->rx_skb);
 	trf->rx_skb = ERR_PTR(errno);