The r8152_eth_probe() may allocate a memory for ss->dev_priv.
It has to be freed if r8152_eth_probe() fails finally.
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
if (usb_set_interface(dev, iface_desc->bInterfaceNumber, 0) ||
!ss->ep_in || !ss->ep_out || !ss->ep_int) {
debug("Problems with device\n");
- return 0;
+ goto error;
}
dev->privptr = (void *)ss;
r8152b_get_version(tp);
if (rtl_ops_init(tp))
- return 0;
+ goto error;
tp->rtl_ops.init(tp);
tp->rtl_ops.up(tp);
DUPLEX_FULL);
return 1;
+
+error:
+ cfree(ss->dev_priv);
+ ss->dev_priv = 0;
+ return 0;
}
int r8152_eth_get_info(struct usb_device *dev, struct ueth_data *ss,