{
__u32 phyid;
unsigned int i;
- int err = 1;
+ int err = -1;
struct mii_ioctl_data *mii;
printk(KERN_INFO PFX "Probing device '%s'\n", devname);
if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
printk(KERN_ERR PFX "No such device\n");
- return 1;
+ err = -ENODEV;
+ goto err_done;
}
if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) {
printk(KERN_ERR PFX "ndo_do_ioctl not implemented in ethernet driver\n");
- return 1;
+ err = -ENXIO;
+ goto err_put;
}
robo.device = devname;
err = do_ioctl(SIOCGMIIPHY);
if (err < 0) {
printk(KERN_ERR PFX "error (%i) while accessing MII phy registers with ioctls\n", err);
- goto done;
+ goto err_put;
}
/* got phy address check for robo address */
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
printk(KERN_ERR PFX "Invalid phy address (%d)\n", mii->phy_id);
- goto done;
+ err = -ENODEV;
+ goto err_put;
}
phyid = mdio_read(ROBO_PHY_ADDR, 0x2) |
if (phyid == 0xffffffff || phyid == 0x55210022) {
printk(KERN_ERR PFX "No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
- goto done;
+ err = -ENODEV;
+ goto err_put;
}
/* Get the device ID */
robo_switch_reset();
err = robo_switch_enable();
if (err)
- goto done;
- err = 0;
+ goto err_put;
printk(KERN_INFO PFX "found a 5%s%x!%s at %s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
robo.is_5350 ? " It's a 5350." : "", devname);
-done:
- if (err) {
- dev_put(robo.dev);
- robo.dev = NULL;
- }
+ return 0;
+err_put:
+ dev_put(robo.dev);
+ robo.dev = NULL;
+err_done:
return err;
}