Skip to content

Commit 80e4232

Browse files
Szymon JancSamuel Ortiz
authored andcommitted
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>
1 parent 36b0511 commit 80e4232

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎net/nfc/hci/command.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,16 @@ static u8 nfc_hci_create_pipe(struct nfc_hci_dev *hdev, u8 dest_host,
257257
*result = nfc_hci_execute_cmd(hdev, NFC_HCI_ADMIN_PIPE,
258258
NFC_HCI_ADM_CREATE_PIPE,
259259
(u8 *) &params, sizeof(params), &skb);
260-
if (*result == 0) {
261-
resp = (struct hci_create_pipe_resp *)skb->data;
262-
pipe = resp->pipe;
263-
kfree_skb(skb);
260+
if (*result < 0)
261+
return NFC_HCI_INVALID_PIPE;
264262

265-
pr_debug("pipe created=%d\n", pipe);
263+
resp = (struct hci_create_pipe_resp *)skb->data;
264+
pipe = resp->pipe;
265+
kfree_skb(skb);
266266

267-
return pipe;
268-
} else
269-
return NFC_HCI_INVALID_PIPE;
267+
pr_debug("pipe created=%d\n", pipe);
268+
269+
return pipe;
270270
}
271271

272272
static int nfc_hci_delete_pipe(struct nfc_hci_dev *hdev, u8 pipe)

0 commit comments

Comments
 (0)