提交 80e4232e 编写于 作者: S Szymon Janc 提交者: Samuel Ortiz

NFC: Small nfc_hci_create_pipe refactoring

Check for error and return if any. This makes it easier to see what is
a 'positive' function flow.
Signed-off-by: NSzymon Janc <szymon.janc@tieto.com>
Signed-off-by: NSamuel Ortiz <sameo@linux.intel.com>
上级 36b05114
...@@ -257,16 +257,16 @@ static u8 nfc_hci_create_pipe(struct nfc_hci_dev *hdev, u8 dest_host, ...@@ -257,16 +257,16 @@ static u8 nfc_hci_create_pipe(struct nfc_hci_dev *hdev, u8 dest_host,
*result = nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE, *result = nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE,
NFC_HCI_ADM_CREATE_PIPE, NFC_HCI_ADM_CREATE_PIPE,
(u8 *) &params, sizeof(params), &skb); (u8 *) &params, sizeof(params), &skb);
if (*result == 0) { if (*result < 0)
resp = (struct hci_create_pipe_resp *)skb->data; return NFC_HCI_INVALID_PIPE;
pipe = resp->pipe;
kfree_skb(skb);
pr_debug("pipe created=%d\n", pipe); resp = (struct hci_create_pipe_resp *)skb->data;
pipe = resp->pipe;
kfree_skb(skb);
return pipe; pr_debug("pipe created=%d\n", pipe);
} else
return NFC_HCI_INVALID_PIPE; return pipe;
} }
static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe) static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册