From: Szymon Janc Date: Thu, 4 Oct 2012 13:15:48 +0000 (+0200) Subject: NFC: Small nfc_hci_create_pipe refactoring X-Git-Tag: MMI-PSA29.97-13-9~15401^2~17^2~315^2~20 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=80e4232ecbc96d01465aee132081daaa2c82e859;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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 Signed-off-by: Samuel Ortiz --- 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 *) ¶ms, 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)