aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVincent Cuissard <cuissard@marvell.com>2015-11-03 13:19:36 -0500
committerSamuel Ortiz <sameo@linux.intel.com>2015-11-04 18:32:25 -0500
commit82aff3ea3b87892ce1476dad83de211741b3ac00 (patch)
treee43189a058731d662bbbd4223db6c7edd8d5d50e
parent6f8c53695d6521c36052d39e29ac1e51ef37eba7 (diff)
NFC: nfcmrvl: avoid being stuck on FW dnld timeout
FW Download procedure can block on del_timer_sync because the timer is not running. This patch check that timer is scheduled before cancelling it. Signed-off-by: Vincent Cuissard <cuissard@marvell.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
-rw-r--r--drivers/nfc/nfcmrvl/fw_dnld.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/nfc/nfcmrvl/fw_dnld.c b/drivers/nfc/nfcmrvl/fw_dnld.c
index bfa771392b1f..f8dcdf4b24f6 100644
--- a/drivers/nfc/nfcmrvl/fw_dnld.c
+++ b/drivers/nfc/nfcmrvl/fw_dnld.c
@@ -113,9 +113,12 @@ static void fw_dnld_over(struct nfcmrvl_private *priv, u32 error)
113 } 113 }
114 114
115 atomic_set(&priv->ndev->cmd_cnt, 0); 115 atomic_set(&priv->ndev->cmd_cnt, 0);
116 del_timer_sync(&priv->ndev->cmd_timer);
117 116
118 del_timer_sync(&priv->fw_dnld.timer); 117 if (timer_pending(&priv->ndev->cmd_timer))
118 del_timer_sync(&priv->ndev->cmd_timer);
119
120 if (timer_pending(&priv->fw_dnld.timer))
121 del_timer_sync(&priv->fw_dnld.timer);
119 122
120 nfc_info(priv->dev, "FW loading over (%d)]\n", error); 123 nfc_info(priv->dev, "FW loading over (%d)]\n", error);
121 124
@@ -472,9 +475,12 @@ void nfcmrvl_fw_dnld_deinit(struct nfcmrvl_private *priv)
472void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv, 475void nfcmrvl_fw_dnld_recv_frame(struct nfcmrvl_private *priv,
473 struct sk_buff *skb) 476 struct sk_buff *skb)
474{ 477{
478 /* Discard command timer */
479 if (timer_pending(&priv->ndev->cmd_timer))
480 del_timer_sync(&priv->ndev->cmd_timer);
481
475 /* Allow next command */ 482 /* Allow next command */
476 atomic_set(&priv->ndev->cmd_cnt, 1); 483 atomic_set(&priv->ndev->cmd_cnt, 1);
477 del_timer_sync(&priv->ndev->cmd_timer);
478 484
479 /* Queue and trigger rx work */ 485 /* Queue and trigger rx work */
480 skb_queue_tail(&priv->fw_dnld.rx_q, skb); 486 skb_queue_tail(&priv->fw_dnld.rx_q, skb);