Search Linux Wireless

[PATCH 2/2] nfc/microread: use correct casting in microread_target_discovered()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fix sparse warnings:

drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:502:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:516:26: warning: cast to restricted __be16
drivers/nfc/microread/microread.c:534:25: warning: cast to restricted __le16

Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
---
 drivers/nfc/microread/microread.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/nfc/microread/microread.c b/drivers/nfc/microread/microread.c
index e5d5d2d97409..cc1fc8d2b04d 100644
--- a/drivers/nfc/microread/microread.c
+++ b/drivers/nfc/microread/microread.c
@@ -499,7 +499,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
 		targets->supported_protocols =
 		      nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A_SAK]);
 		targets->sens_res =
-			 be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A_ATQA]);
+			 be16_to_cpup((__be16 *)&skb->data[MICROREAD_EMCF_A_ATQA]);
 		targets->sel_res = skb->data[MICROREAD_EMCF_A_SAK];
 		targets->nfcid1_len = skb->data[MICROREAD_EMCF_A_LEN];
 		if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
@@ -513,7 +513,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
 		targets->supported_protocols =
 		      nfc_hci_sak_to_protocol(skb->data[MICROREAD_EMCF_A3_SAK]);
 		targets->sens_res =
-			 be16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]);
+			 be16_to_cpup((__be16 *)&skb->data[MICROREAD_EMCF_A3_ATQA]);
 		targets->sel_res = skb->data[MICROREAD_EMCF_A3_SAK];
 		targets->nfcid1_len = skb->data[MICROREAD_EMCF_A3_LEN];
 		if (targets->nfcid1_len > sizeof(targets->nfcid1)) {
@@ -531,7 +531,7 @@ static void microread_target_discovered(struct nfc_hci_dev *hdev, u8 gate,
 	case MICROREAD_GATE_ID_MREAD_NFC_T1:
 		targets->supported_protocols = NFC_PROTO_JEWEL_MASK;
 		targets->sens_res =
-			le16_to_cpu(*(u16 *)&skb->data[MICROREAD_EMCF_T1_ATQA]);
+			le16_to_cpup((__le16 *)&skb->data[MICROREAD_EMCF_T1_ATQA]);
 		memcpy(targets->nfcid1, &skb->data[MICROREAD_EMCF_T1_UID], 4);
 		targets->nfcid1_len = 4;
 		break;
-- 
2.20.1




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Wireless Regulations]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux