diff options
author | hayeswang <hayeswang@realtek.com> | 2014-01-06 04:08:43 -0500 |
---|---|---|
committer | Vladislav Zhurba <vzhurba@nvidia.com> | 2018-02-01 16:57:59 -0500 |
commit | 18d3928199d864dea8684ffbd68b4ddac92c4730 (patch) | |
tree | 9a8eae9fec0e2b8530943491f6bb61a0d71a040b /drivers/net/usb/r8152_shield.c | |
parent | fc3e48109b22c3c62b596934433092b60bfd5941 (diff) |
r8152: replace the return value of rtl_ops_init
Replace the boolean value with the error code for the return value
of the rtl_ops_init().
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Preetham Chandru R <pchandru@nvidia.com>
(cherry picked from commit 31ca1decfbc5fe86094c6c8f0a590a2c0a29fabf)
Change-Id: I16a734ddb0639376e533fa34a5a9b1fcd2e68cc7
Reviewed-on: http://git-master/r/370009
Tested-by: Aly Hirani <ahirani@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Venkat Moganty <vmoganty@nvidia.com>
Diffstat (limited to 'drivers/net/usb/r8152_shield.c')
-rw-r--r-- | drivers/net/usb/r8152_shield.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/drivers/net/usb/r8152_shield.c b/drivers/net/usb/r8152_shield.c index 861568109..881475f48 100644 --- a/drivers/net/usb/r8152_shield.c +++ b/drivers/net/usb/r8152_shield.c | |||
@@ -2685,10 +2685,10 @@ static void rtl8153_unload(struct r8152 *tp) | |||
2685 | r8153_power_cut_en(tp, 1); | 2685 | r8153_power_cut_en(tp, 1); |
2686 | } | 2686 | } |
2687 | 2687 | ||
2688 | static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | 2688 | static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) |
2689 | { | 2689 | { |
2690 | struct rtl_ops *ops = &tp->rtl_ops; | 2690 | struct rtl_ops *ops = &tp->rtl_ops; |
2691 | bool ret = true; | 2691 | int ret = -ENODEV; |
2692 | 2692 | ||
2693 | switch (id->idVendor) { | 2693 | switch (id->idVendor) { |
2694 | case VENDOR_ID_REALTEK: | 2694 | case VENDOR_ID_REALTEK: |
@@ -2699,6 +2699,7 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
2699 | ops->disable = rtl8152_disable; | 2699 | ops->disable = rtl8152_disable; |
2700 | ops->down = rtl8152_down; | 2700 | ops->down = rtl8152_down; |
2701 | ops->unload = rtl8152_unload; | 2701 | ops->unload = rtl8152_unload; |
2702 | ret = 0; | ||
2702 | break; | 2703 | break; |
2703 | case PRODUCT_ID_RTL8153: | 2704 | case PRODUCT_ID_RTL8153: |
2704 | ops->init = r8153_init; | 2705 | ops->init = r8153_init; |
@@ -2706,9 +2707,9 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
2706 | ops->disable = rtl8152_disable; | 2707 | ops->disable = rtl8152_disable; |
2707 | ops->down = rtl8153_down; | 2708 | ops->down = rtl8153_down; |
2708 | ops->unload = rtl8153_unload; | 2709 | ops->unload = rtl8153_unload; |
2710 | ret = 0; | ||
2709 | break; | 2711 | break; |
2710 | default: | 2712 | default: |
2711 | ret = false; | ||
2712 | break; | 2713 | break; |
2713 | } | 2714 | } |
2714 | break; | 2715 | break; |
@@ -2721,18 +2722,20 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) | |||
2721 | ops->disable = rtl8152_disable; | 2722 | ops->disable = rtl8152_disable; |
2722 | ops->down = rtl8153_down; | 2723 | ops->down = rtl8153_down; |
2723 | ops->unload = rtl8153_unload; | 2724 | ops->unload = rtl8153_unload; |
2725 | ret = 0; | ||
2724 | break; | 2726 | break; |
2725 | default: | 2727 | default: |
2726 | ret = false; | ||
2727 | break; | 2728 | break; |
2728 | } | 2729 | } |
2729 | break; | 2730 | break; |
2730 | 2731 | ||
2731 | default: | 2732 | default: |
2732 | ret = false; | ||
2733 | break; | 2733 | break; |
2734 | } | 2734 | } |
2735 | 2735 | ||
2736 | if (ret) | ||
2737 | netif_err(tp, probe, tp->netdev, "Unknown Device\n"); | ||
2738 | |||
2736 | return ret; | 2739 | return ret; |
2737 | } | 2740 | } |
2738 | 2741 | ||
@@ -2763,10 +2766,9 @@ static int rtl8152_probe(struct usb_interface *intf, | |||
2763 | tp->netdev = netdev; | 2766 | tp->netdev = netdev; |
2764 | tp->intf = intf; | 2767 | tp->intf = intf; |
2765 | 2768 | ||
2766 | if (!rtl_ops_init(tp, id)) { | 2769 | ret = rtl_ops_init(tp, id); |
2767 | netif_err(tp, probe, netdev, "Unknown Device"); | 2770 | if (ret) |
2768 | return -ENODEV; | 2771 | goto out; |
2769 | } | ||
2770 | 2772 | ||
2771 | tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); | 2773 | tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); |
2772 | INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); | 2774 | INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); |