summaryrefslogtreecommitdiff
path: root/net/nfc/digital_technology.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/nfc/digital_technology.c')
-rw-r--r--net/nfc/digital_technology.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/net/nfc/digital_technology.c b/net/nfc/digital_technology.c
index d9080dec5d27..2021d1d58a75 100644
--- a/net/nfc/digital_technology.c
+++ b/net/nfc/digital_technology.c
@@ -27,6 +27,7 @@
#define DIGITAL_SDD_RES_CT 0x88
#define DIGITAL_SDD_RES_LEN 5
+#define DIGITAL_SEL_RES_LEN 1
#define DIGITAL_SEL_RES_NFCID1_COMPLETE(sel_res) (!((sel_res) & 0x04))
#define DIGITAL_SEL_RES_IS_T2T(sel_res) (!((sel_res) & 0x60))
@@ -266,8 +267,8 @@ static int digital_in_send_rats(struct nfc_digital_dev *ddev,
if (!skb)
return -ENOMEM;
- *skb_put(skb, 1) = DIGITAL_RATS_BYTE1;
- *skb_put(skb, 1) = DIGITAL_RATS_PARAM;
+ skb_put_u8(skb, DIGITAL_RATS_BYTE1);
+ skb_put_u8(skb, DIGITAL_RATS_PARAM);
rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_ats,
target);
@@ -299,7 +300,7 @@ static void digital_in_recv_sel_res(struct nfc_digital_dev *ddev, void *arg,
}
}
- if (!resp->len) {
+ if (resp->len != DIGITAL_SEL_RES_LEN) {
rc = -EIO;
goto exit;
}
@@ -470,8 +471,8 @@ static int digital_in_send_sdd_req(struct nfc_digital_dev *ddev,
else
sel_cmd = DIGITAL_CMD_SEL_REQ_CL3;
- *skb_put(skb, sizeof(u8)) = sel_cmd;
- *skb_put(skb, sizeof(u8)) = DIGITAL_SDD_REQ_SEL_PAR;
+ skb_put_u8(skb, sel_cmd);
+ skb_put_u8(skb, DIGITAL_SDD_REQ_SEL_PAR);
return digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sdd_res,
target);
@@ -541,7 +542,7 @@ int digital_in_send_sens_req(struct nfc_digital_dev *ddev, u8 rf_tech)
if (!skb)
return -ENOMEM;
- *skb_put(skb, sizeof(u8)) = DIGITAL_CMD_SENS_REQ;
+ skb_put_u8(skb, DIGITAL_CMD_SENS_REQ);
rc = digital_in_send_cmd(ddev, skb, 30, digital_in_recv_sens_res, NULL);
if (rc)
@@ -625,8 +626,7 @@ static int digital_in_send_attrib_req(struct nfc_digital_dev *ddev,
if (!skb)
return -ENOMEM;
- attrib_req = (struct digital_attrib_req *)skb_put(skb,
- sizeof(*attrib_req));
+ attrib_req = skb_put(skb, sizeof(*attrib_req));
attrib_req->cmd = DIGITAL_CMD_ATTRIB_REQ;
memcpy(attrib_req->nfcid0, sensb_res->nfcid0,
@@ -730,8 +730,7 @@ int digital_in_send_sensb_req(struct nfc_digital_dev *ddev, u8 rf_tech)
if (!skb)
return -ENOMEM;
- sensb_req = (struct digital_sensb_req *)skb_put(skb,
- sizeof(*sensb_req));
+ sensb_req = skb_put(skb, sizeof(*sensb_req));
sensb_req->cmd = DIGITAL_CMD_SENSB_REQ;
sensb_req->afi = 0x00; /* All families and sub-families */
@@ -830,7 +829,7 @@ int digital_in_send_sensf_req(struct nfc_digital_dev *ddev, u8 rf_tech)
sensf_req->rc = 0;
sensf_req->tsn = 0;
- *skb_push(skb, 1) = size + 1;
+ *(u8 *)skb_push(skb, 1) = size + 1;
if (!DIGITAL_DRV_CAPS_IN_CRC(ddev))
digital_skb_add_crc_f(skb);
@@ -939,7 +938,7 @@ static int digital_tg_send_sel_res(struct nfc_digital_dev *ddev)
if (!skb)
return -ENOMEM;
- *skb_put(skb, 1) = DIGITAL_SEL_RES_NFC_DEP;
+ skb_put_u8(skb, DIGITAL_SEL_RES_NFC_DEP);
if (!DIGITAL_DRV_CAPS_TG_CRC(ddev))
digital_skb_add_crc_a(skb);
@@ -1163,7 +1162,7 @@ static int digital_tg_send_sensf_res(struct nfc_digital_dev *ddev,
break;
}
- *skb_push(skb, sizeof(u8)) = size + 1;
+ *(u8 *)skb_push(skb, sizeof(u8)) = size + 1;
if (!DIGITAL_DRV_CAPS_TG_CRC(ddev))
digital_skb_add_crc_f(skb);