Commit 4b99b749 authored by wengjianfeng's avatar wengjianfeng Committed by David S. Miller

NFC: st21nfca: remove unnecessary variable and labels

assign vlue (EIO/EPROTO) to variable r, and goto exit label,
but just return r follow exit label, so we delete exit label,
and just replace with return sentence.
Signed-off-by: default avatarwengjianfeng <wengjianfeng@yulong.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ba102914
...@@ -196,38 +196,29 @@ static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev, ...@@ -196,38 +196,29 @@ static int st21nfca_tm_recv_atr_req(struct nfc_hci_dev *hdev,
skb_trim(skb, skb->len - 1); skb_trim(skb, skb->len - 1);
if (!skb->len) { if (!skb->len)
r = -EIO; return -EIO;
goto exit;
}
if (skb->len < ST21NFCA_ATR_REQ_MIN_SIZE) { if (skb->len < ST21NFCA_ATR_REQ_MIN_SIZE)
r = -EPROTO; return -EPROTO;
goto exit;
}
atr_req = (struct st21nfca_atr_req *)skb->data; atr_req = (struct st21nfca_atr_req *)skb->data;
if (atr_req->length < sizeof(struct st21nfca_atr_req)) { if (atr_req->length < sizeof(struct st21nfca_atr_req))
r = -EPROTO; return -EPROTO;
goto exit;
}
r = st21nfca_tm_send_atr_res(hdev, atr_req); r = st21nfca_tm_send_atr_res(hdev, atr_req);
if (r) if (r)
goto exit; return r;
gb_len = skb->len - sizeof(struct st21nfca_atr_req); gb_len = skb->len - sizeof(struct st21nfca_atr_req);
r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK, r = nfc_tm_activated(hdev->ndev, NFC_PROTO_NFC_DEP_MASK,
NFC_COMM_PASSIVE, atr_req->gbi, gb_len); NFC_COMM_PASSIVE, atr_req->gbi, gb_len);
if (r) if (r)
goto exit; return r;
r = 0;
exit: return 0;
return r;
} }
static int st21nfca_tm_send_psl_res(struct nfc_hci_dev *hdev, static int st21nfca_tm_send_psl_res(struct nfc_hci_dev *hdev,
...@@ -280,25 +271,18 @@ static int st21nfca_tm_recv_psl_req(struct nfc_hci_dev *hdev, ...@@ -280,25 +271,18 @@ static int st21nfca_tm_recv_psl_req(struct nfc_hci_dev *hdev,
struct sk_buff *skb) struct sk_buff *skb)
{ {
struct st21nfca_psl_req *psl_req; struct st21nfca_psl_req *psl_req;
int r;
skb_trim(skb, skb->len - 1); skb_trim(skb, skb->len - 1);
if (!skb->len) { if (!skb->len)
r = -EIO; return -EIO;
goto exit;
}
psl_req = (struct st21nfca_psl_req *)skb->data; psl_req = (struct st21nfca_psl_req *)skb->data;
if (skb->len < sizeof(struct st21nfca_psl_req)) { if (skb->len < sizeof(struct st21nfca_psl_req))
r = -EIO; return -EIO;
goto exit;
}
r = st21nfca_tm_send_psl_res(hdev, psl_req); return st21nfca_tm_send_psl_res(hdev, psl_req);
exit:
return r;
} }
int st21nfca_tm_send_dep_res(struct nfc_hci_dev *hdev, struct sk_buff *skb) int st21nfca_tm_send_dep_res(struct nfc_hci_dev *hdev, struct sk_buff *skb)
...@@ -324,7 +308,6 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev, ...@@ -324,7 +308,6 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev,
{ {
struct st21nfca_dep_req_res *dep_req; struct st21nfca_dep_req_res *dep_req;
u8 size; u8 size;
int r;
struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev); struct st21nfca_hci_info *info = nfc_hci_get_clientdata(hdev);
skb_trim(skb, skb->len - 1); skb_trim(skb, skb->len - 1);
...@@ -332,20 +315,16 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev, ...@@ -332,20 +315,16 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev,
size = 4; size = 4;
dep_req = (struct st21nfca_dep_req_res *)skb->data; dep_req = (struct st21nfca_dep_req_res *)skb->data;
if (skb->len < size) { if (skb->len < size)
r = -EIO; return -EIO;
goto exit;
}
if (ST21NFCA_NFC_DEP_DID_BIT_SET(dep_req->pfb)) if (ST21NFCA_NFC_DEP_DID_BIT_SET(dep_req->pfb))
size++; size++;
if (ST21NFCA_NFC_DEP_NAD_BIT_SET(dep_req->pfb)) if (ST21NFCA_NFC_DEP_NAD_BIT_SET(dep_req->pfb))
size++; size++;
if (skb->len < size) { if (skb->len < size)
r = -EIO; return -EIO;
goto exit;
}
/* Receiving DEP_REQ - Decoding */ /* Receiving DEP_REQ - Decoding */
switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_req->pfb)) { switch (ST21NFCA_NFC_DEP_PFB_TYPE(dep_req->pfb)) {
...@@ -364,8 +343,6 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev, ...@@ -364,8 +343,6 @@ static int st21nfca_tm_recv_dep_req(struct nfc_hci_dev *hdev,
skb_pull(skb, size); skb_pull(skb, size);
return nfc_tm_data_received(hdev->ndev, skb); return nfc_tm_data_received(hdev->ndev, skb);
exit:
return r;
} }
static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev, static int st21nfca_tm_event_send_data(struct nfc_hci_dev *hdev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment