diff options
author | Samuel Ortiz <sameo@linux.intel.com> | 2013-05-24 19:21:21 -0400 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2013-06-13 18:26:10 -0400 |
commit | a395298c9c96748cbd6acee4cb9a5ba13fbb3ab8 (patch) | |
tree | 050bb8b224c4941509633b22aaf310db2256c901 /net/nfc/hci | |
parent | 9a695d23aab889273821c91b4132f1ed315b251b (diff) |
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: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc/hci')
-rw-r--r-- | net/nfc/hci/core.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/net/nfc/hci/core.c b/net/nfc/hci/core.c index b7e4dac5654e..d2ef1e2ee0c6 100644 --- a/net/nfc/hci/core.c +++ b/net/nfc/hci/core.c | |||
@@ -570,21 +570,21 @@ static int hci_dep_link_up(struct nfc_dev *nfc_dev, struct nfc_target *target, | |||
570 | { | 570 | { |
571 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 571 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
572 | 572 | ||
573 | if (hdev->ops->dep_link_up) | 573 | if (!hdev->ops->dep_link_up) |
574 | return hdev->ops->dep_link_up(hdev, target, comm_mode, | 574 | return 0; |
575 | gb, gb_len); | ||
576 | 575 | ||
577 | return 0; | 576 | return hdev->ops->dep_link_up(hdev, target, comm_mode, |
577 | gb, gb_len); | ||
578 | } | 578 | } |
579 | 579 | ||
580 | static int hci_dep_link_down(struct nfc_dev *nfc_dev) | 580 | static int hci_dep_link_down(struct nfc_dev *nfc_dev) |
581 | { | 581 | { |
582 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 582 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
583 | 583 | ||
584 | if (hdev->ops->dep_link_down) | 584 | if (!hdev->ops->dep_link_down) |
585 | return hdev->ops->dep_link_down(hdev); | 585 | return 0; |
586 | 586 | ||
587 | return 0; | 587 | return hdev->ops->dep_link_down(hdev); |
588 | } | 588 | } |
589 | 589 | ||
590 | static int hci_activate_target(struct nfc_dev *nfc_dev, | 590 | 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 | { | 673 | { |
674 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 674 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
675 | 675 | ||
676 | if (hdev->ops->tm_send) | 676 | if (!hdev->ops->tm_send) { |
677 | return hdev->ops->tm_send(hdev, skb); | 677 | kfree_skb(skb); |
678 | 678 | return -ENOTSUPP; | |
679 | kfree_skb(skb); | 679 | } |
680 | 680 | ||
681 | return -ENOTSUPP; | 681 | return hdev->ops->tm_send(hdev, skb); |
682 | } | 682 | } |
683 | 683 | ||
684 | static int hci_check_presence(struct nfc_dev *nfc_dev, | 684 | 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 | { | 686 | { |
687 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 687 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
688 | 688 | ||
689 | if (hdev->ops->check_presence) | 689 | if (!hdev->ops->check_presence) |
690 | return hdev->ops->check_presence(hdev, target); | 690 | return 0; |
691 | 691 | ||
692 | return 0; | 692 | return hdev->ops->check_presence(hdev, target); |
693 | } | 693 | } |
694 | 694 | ||
695 | static void nfc_hci_failure(struct nfc_hci_dev *hdev, int err) | 695 | 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 | { | 783 | { |
784 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); | 784 | struct nfc_hci_dev *hdev = nfc_get_drvdata(nfc_dev); |
785 | 785 | ||
786 | if (hdev->ops->fw_upload) | 786 | if (!hdev->ops->fw_upload) |
787 | return hdev->ops->fw_upload(hdev, firmware_name); | 787 | return -ENOTSUPP; |
788 | 788 | ||
789 | return -ENOTSUPP; | 789 | return hdev->ops->fw_upload(hdev, firmware_name); |
790 | } | 790 | } |
791 | 791 | ||
792 | static struct nfc_ops hci_nfc_ops = { | 792 | static struct nfc_ops hci_nfc_ops = { |