summaryrefslogtreecommitdiff
path: root/net/nfc/hci
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-10-04 15:15:48 +0200
committerSamuel Ortiz <sameo@linux.intel.com>2012-10-26 18:26:48 +0200
commit80e4232ecbc96d01465aee132081daaa2c82e859 (patch)
tree038569689ee44b541b668d7f81f3db031706fe9f /net/nfc/hci
parent36b05114d137838508ff132ef33c799a02727e1f (diff)
downloadlwn-80e4232ecbc96d01465aee132081daaa2c82e859.tar.gz
lwn-80e4232ecbc96d01465aee132081daaa2c82e859.zip
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: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/hci')
-rw-r--r--net/nfc/hci/command.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/net/nfc/hci/command.c b/net/nfc/hci/command.c
index 71c6a7086b8f..e15dd684854b 100644
--- a/net/nfc/hci/command.c
+++ b/net/nfc/hci/command.c
@@ -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,
NFC_HCI_ADM_CREATE_PIPE,
(u8 *) &params, sizeof(params), &skb);
- if (*result == 0) {
- resp = (struct hci_create_pipe_resp *)skb->data;
- pipe = resp->pipe;
- kfree_skb(skb);
+ if (*result < 0)
+ return NFC_HCI_INVALID_PIPE;
- pr_debug("pipe created=%d\n", pipe);
+ resp = (struct hci_create_pipe_resp *)skb->data;
+ pipe = resp->pipe;
+ kfree_skb(skb);
- return pipe;
- } else
- return NFC_HCI_INVALID_PIPE;
+ pr_debug("pipe created=%d\n", pipe);
+
+ return pipe;
}
static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe)