aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorChristophe Ricard <christophe.ricard@gmail.com>2015-03-31 02:02:22 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2015-04-05 18:19:22 -0400
commit1dab57f0ed753ddef07a8aa987d490c74884ff18 (patch)
tree9e64fd764e722139686ee8e69281c5de1509f52e /drivers/nfc
parent1f74f323e2c30b7fd53f6ad16c1990f2c80bbfc0 (diff)
nfc: st21nfcb: Add additional comments about EVT_TRANSACTION
Add comments about HCI EVT_TRANSACTION in order to make the code understandable by other readers. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/st21nfcb/st21nfcb_se.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/nfc/st21nfcb/st21nfcb_se.c b/drivers/nfc/st21nfcb/st21nfcb_se.c
index 6df7b950d0e9..24862a525fb5 100644
--- a/drivers/nfc/st21nfcb/st21nfcb_se.c
+++ b/drivers/nfc/st21nfcb/st21nfcb_se.c
@@ -321,6 +321,12 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev,
321 321
322 break; 322 break;
323 case ST21NFCB_EVT_TRANSACTION: 323 case ST21NFCB_EVT_TRANSACTION:
324 /* According to specification etsi 102 622
325 * 11.2.2.4 EVT_TRANSACTION Table 52
326 * Description Tag Length
327 * AID 81 5 to 16
328 * PARAMETERS 82 0 to 255
329 */
324 if (skb->len < NFC_MIN_AID_LENGTH + 2 && 330 if (skb->len < NFC_MIN_AID_LENGTH + 2 &&
325 skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG) 331 skb->data[0] != NFC_EVT_TRANSACTION_AID_TAG)
326 return -EPROTO; 332 return -EPROTO;
@@ -329,8 +335,9 @@ static int st21nfcb_hci_connectivity_event_received(struct nci_dev *ndev,
329 skb->len - 2, GFP_KERNEL); 335 skb->len - 2, GFP_KERNEL);
330 336
331 transaction->aid_len = skb->data[1]; 337 transaction->aid_len = skb->data[1];
332 memcpy(transaction->aid, &skb->data[2], skb->data[1]); 338 memcpy(transaction->aid, &skb->data[2], transaction->aid_len);
333 339
340 /* Check next byte is PARAMETERS tag (82) */
334 if (skb->data[transaction->aid_len + 2] != 341 if (skb->data[transaction->aid_len + 2] !=
335 NFC_EVT_TRANSACTION_PARAMS_TAG) 342 NFC_EVT_TRANSACTION_PARAMS_TAG)
336 return -EPROTO; 343 return -EPROTO;