NFC: st21nfcb: Fix st21nfcb_nci_close
authorChristophe Ricard <christophe.ricard@gmail.com>
Sat, 6 Jun 2015 11:16:46 +0000 (13:16 +0200)
committerSamuel Ortiz <sameo@linux.intel.com>
Mon, 8 Jun 2015 22:34:23 +0000 (00:34 +0200)
When closing st21nfcb driver, flag ST21NFCB_NCI_RUNNING can be cleared
only once the ndlc and the transport (i2c or spi) layers are released.

Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/nfc/st21nfcb/st21nfcb.c

index 7a51bf056a6993f52a02b6884edcf9d2c645a221..12699fa0b1b992683a08cc7c6e287bf899dd139c 100644 (file)
@@ -47,11 +47,13 @@ static int st21nfcb_nci_close(struct nci_dev *ndev)
 {
        struct st21nfcb_nci_info *info = nci_get_drvdata(ndev);
 
-       if (!test_and_clear_bit(ST21NFCB_NCI_RUNNING, &info->flags))
+       if (!test_bit(ST21NFCB_NCI_RUNNING, &info->flags))
                return 0;
 
        ndlc_close(info->ndlc);
 
+       clear_bit(ST21NFCB_NCI_RUNNING, &info->flags);
+
        return 0;
 }