Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 80e4232e authored by Szymon Janc's avatar Szymon Janc Committed by Samuel Ortiz
Browse files

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: default avatarSzymon Janc <szymon.janc@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 36b05114
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -257,7 +257,9 @@ 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)
		return NFC_HCI_INVALID_PIPE;

	resp = (struct hci_create_pipe_resp *)skb->data;
	resp = (struct hci_create_pipe_resp *)skb->data;
	pipe = resp->pipe;
	pipe = resp->pipe;
	kfree_skb(skb);
	kfree_skb(skb);
@@ -265,8 +267,6 @@ static u8 nfc_hci_create_pipe(struct nfc_hci_dev *hdev, u8 dest_host,
	pr_debug("pipe created=%d\n", pipe);
	pr_debug("pipe created=%d\n", pipe);


	return pipe;
	return pipe;
	} else
		return NFC_HCI_INVALID_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)