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>
This commit is contained in:
hayeswang 2014-01-06 17:08:43 +08:00 коммит произвёл David S. Miller
Родитель e3ad412ad8
Коммит 31ca1decfb
1 изменённых файлов: 11 добавлений и 9 удалений

Просмотреть файл

@ -2685,10 +2685,10 @@ static void rtl8153_unload(struct r8152 *tp)
r8153_power_cut_en(tp, 1); r8153_power_cut_en(tp, 1);
} }
static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id) static int rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
{ {
struct rtl_ops *ops = &tp->rtl_ops; struct rtl_ops *ops = &tp->rtl_ops;
bool ret = true; int ret = -ENODEV;
switch (id->idVendor) { switch (id->idVendor) {
case VENDOR_ID_REALTEK: case VENDOR_ID_REALTEK:
@ -2699,6 +2699,7 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->disable = rtl8152_disable; ops->disable = rtl8152_disable;
ops->down = rtl8152_down; ops->down = rtl8152_down;
ops->unload = rtl8152_unload; ops->unload = rtl8152_unload;
ret = 0;
break; break;
case PRODUCT_ID_RTL8153: case PRODUCT_ID_RTL8153:
ops->init = r8153_init; ops->init = r8153_init;
@ -2706,9 +2707,9 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->disable = rtl8152_disable; ops->disable = rtl8152_disable;
ops->down = rtl8153_down; ops->down = rtl8153_down;
ops->unload = rtl8153_unload; ops->unload = rtl8153_unload;
ret = 0;
break; break;
default: default:
ret = false;
break; break;
} }
break; break;
@ -2721,18 +2722,20 @@ static bool rtl_ops_init(struct r8152 *tp, const struct usb_device_id *id)
ops->disable = rtl8152_disable; ops->disable = rtl8152_disable;
ops->down = rtl8153_down; ops->down = rtl8153_down;
ops->unload = rtl8153_unload; ops->unload = rtl8153_unload;
ret = 0;
break; break;
default: default:
ret = false;
break; break;
} }
break; break;
default: default:
ret = false;
break; break;
} }
if (ret)
netif_err(tp, probe, tp->netdev, "Unknown Device\n");
return ret; return ret;
} }
@ -2763,10 +2766,9 @@ static int rtl8152_probe(struct usb_interface *intf,
tp->netdev = netdev; tp->netdev = netdev;
tp->intf = intf; tp->intf = intf;
if (!rtl_ops_init(tp, id)) { ret = rtl_ops_init(tp, id);
netif_err(tp, probe, netdev, "Unknown Device"); if (ret)
return -ENODEV; goto out;
}
tasklet_init(&tp->tl, bottom_half, (unsigned long)tp); tasklet_init(&tp->tl, bottom_half, (unsigned long)tp);
INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t); INIT_DELAYED_WORK(&tp->schedule, rtl_work_func_t);