]> Pileus Git - ~andy/linux/blobdiff - drivers/sh/superhyway/superhyway.c
Merge git://git.kernel.org/pub/scm/linux/kernel/git/mingo/linux-2.6-sched
[~andy/linux] / drivers / sh / superhyway / superhyway.c
index 7bdab2a7f59c61f25f7dd8b6b44c1b10e5ff6b42..4d0282b821b519b3bd750cd5266ea9a02b78cd26 100644 (file)
@@ -56,11 +56,10 @@ int superhyway_add_device(unsigned long base, struct superhyway_device *sdev,
        struct superhyway_device *dev = sdev;
 
        if (!dev) {
-               dev = kmalloc(sizeof(struct superhyway_device), GFP_KERNEL);
+               dev = kzalloc(sizeof(struct superhyway_device), GFP_KERNEL);
                if (!dev)
                        return -ENOMEM;
 
-               memset(dev, 0, sizeof(struct superhyway_device));
        }
 
        dev->bus = bus;
@@ -108,16 +107,17 @@ int superhyway_add_devices(struct superhyway_bus *bus,
 static int __init superhyway_init(void)
 {
        struct superhyway_bus *bus;
-       int ret = 0;
+       int ret;
 
-       device_register(&superhyway_bus_device);
+       ret = device_register(&superhyway_bus_device);
+       if (unlikely(ret))
+               return ret;
 
        for (bus = superhyway_channels; bus->ops; bus++)
                ret |= superhyway_scan_bus(bus);
 
        return ret;
 }
-
 postcore_initcall(superhyway_init);
 
 static const struct superhyway_device_id *
@@ -175,8 +175,6 @@ int superhyway_register_driver(struct superhyway_driver *drv)
 {
        drv->drv.name   = drv->name;
        drv->drv.bus    = &superhyway_bus_type;
-       drv->drv.probe  = superhyway_device_probe;
-       drv->drv.remove = superhyway_device_remove;
 
        return driver_register(&drv->drv);
 }
@@ -213,6 +211,8 @@ struct bus_type superhyway_bus_type = {
 #ifdef CONFIG_SYSFS
        .dev_attrs      = superhyway_dev_attrs,
 #endif
+       .probe          = superhyway_device_probe,
+       .remove         = superhyway_device_remove,
 };
 
 static int __init superhyway_bus_init(void)