Commit a395298c authored by Samuel Ortiz's avatar Samuel Ortiz

NFC: HCI: Follow a positive code path in the HCI ops implementations

Exiting on the error case is more typical to the kernel coding style.
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 9a695d23
...@@ -570,21 +570,21 @@ static int hci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, ...@@ -570,21 +570,21 @@ static int hci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target,
{ {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->dep_link_up) if (!hdev->ops->dep_link_up)
return hdev->ops->dep_link_up(hdev, target, comm_mode, return 0;
gb, gb_len);
return 0; return hdev->ops->dep_link_up(hdev, target, comm_mode,
gb, gb_len);
} }
static int hci_dep_link_down(struct nfc_dev *nfc_dev) static int hci_dep_link_down(struct nfc_dev *nfc_dev)
{ {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->dep_link_down) if (!hdev->ops->dep_link_down)
return hdev->ops->dep_link_down(hdev); return 0;
return 0; return hdev->ops->dep_link_down(hdev);
} }
static int hci_activate_target(struct nfc_dev *nfc_dev, static int hci_activate_target(struct nfc_dev *nfc_dev,
...@@ -673,12 +673,12 @@ static int hci_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb) ...@@ -673,12 +673,12 @@ static int hci_tm_send(struct nfc_dev *nfc_dev, struct sk_buff *skb)
{ {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->tm_send) if (!hdev->ops->tm_send) {
return hdev->ops->tm_send(hdev, skb); kfree_skb(skb);
return -ENOTSUPP;
kfree_skb(skb); }
return -ENOTSUPP; return hdev->ops->tm_send(hdev, skb);
} }
static int hci_check_presence(struct nfc_dev *nfc_dev, static int hci_check_presence(struct nfc_dev *nfc_dev,
...@@ -686,10 +686,10 @@ static int hci_check_presence(struct nfc_dev *nfc_dev, ...@@ -686,10 +686,10 @@ static int hci_check_presence(struct nfc_dev *nfc_dev,
{ {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->check_presence) if (!hdev->ops->check_presence)
return hdev->ops->check_presence(hdev, target); return 0;
return 0; return hdev->ops->check_presence(hdev, target);
} }
static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err) static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err)
...@@ -783,10 +783,10 @@ static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name) ...@@ -783,10 +783,10 @@ static int hci_fw_upload(struct nfc_dev *nfc_dev, const char *firmware_name)
{ {
struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev);
if (hdev->ops->fw_upload) if (!hdev->ops->fw_upload)
return hdev->ops->fw_upload(hdev, firmware_name); return -ENOTSUPP;
return -ENOTSUPP; return hdev->ops->fw_upload(hdev, firmware_name);
} }
static struct nfc_ops hci_nfc_ops = { static struct nfc_ops hci_nfc_ops = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment