On Mon, May 07, 2012 at 09:26:07AM +0200, Samuel Iglesias Gonsalvez wrote: > +int ipack_bus_register(struct ipack_bus_device *bus) > +{ > + int bus_nr; Blank line here between declaration and code. > + bus_nr = ipack_assign_bus_number(); > + if (bus_nr < 0) > + return -1; > + bus->bus_nr = bus_nr; > + return 0; > +} > +EXPORT_SYMBOL_GPL(ipack_bus_register); [snip] > +int ipack_driver_register(struct ipack_driver *edrv) > +{ > + int ret; > + > + edrv->driver.bus = &ipack_bus_type; > + ret = driver_register(&edrv->driver); > + if (ret < 0) > + goto exit_driver_register; > + > +exit_driver_register: > + return ret; > +} Better to write it like this: int ipack_driver_register(struct ipack_driver *edrv) { edrv->driver.bus = &ipack_bus_type; return driver_register(&edrv->driver); } [snip] > +int ipack_device_find_drv(struct device_driver *driver, void *param) > +{ > + int ret; > + struct ipack_device *dev = (struct ipack_device *)param; > + > + ret = ipack_bus_match(&dev->dev, driver); > + if (ret) > + return !ipack_bus_probe(&dev->dev); Wouldn't probe() return zero or a negative error code? > + > + return ret; return 0; > +} > + > +int ipack_device_register(struct ipack_device *dev) > +{ > + int ret; > + > + if (!bus_for_each_drv(&ipack_bus_type, NULL, dev, ipack_device_find_drv)) { > + ret = -ENODEV; > + goto exit_device_register; Just return directly here. I was expecting a reason for a goto but a nonsense goto is misleading. > + } > + > + dev->dev.bus = &ipack_bus_type; > + dev->dev.release = ipack_device_release; > + dev_set_name(&dev->dev, "%s.%u.%u", dev->board_name, dev->bus_nr, dev->slot); > + ret = device_register(&dev->dev); > + if (ret < 0) { > + printk(KERN_ERR "ipack: error registering the device.\n"); > + dev->driver->ops->remove(dev); > + } > + > +exit_device_register: > + return ret; > +} regards, dan carpenter _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel