Hi, On Tue, 17 Jul 2012, Ming Lei wrote: > On Tue, Jul 3, 2012 at 1:08 AM, Sebastian Ott <seb...@linux.vnet.ibm.com> > wrote: > > > --- a/drivers/base/driver.c > > +++ b/drivers/base/driver.c > > @@ -187,6 +187,9 @@ int driver_register(struct device_driver > > ret = driver_add_groups(drv, drv->groups); > > if (ret) > > bus_remove_driver(drv); > > + > > + kobject_uevent(&drv->p->kobj, KOBJ_ADD); > > You should just send the uevent if 'ret' equals to zero., otherwise > OOPS may be triggered by kobject_uevent() after the 'drv' has been > removed.
oh..sorry. Missed that. Thanks for catching it! Updated Patch: [PATCH] driver core: move uevent call to driver_register Device driver attribute groups are created after userspace is notified via an add event. Fix this by moving the kobject_uevent call to driver_register after the attribute groups are added. Signed-off-by: Sebastian Ott <seb...@linux.vnet.ibm.com> --- drivers/base/bus.c | 1 - drivers/base/driver.c | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) --- a/drivers/base/bus.c +++ b/drivers/base/bus.c @@ -743,7 +743,6 @@ int bus_add_driver(struct device_driver } } - kobject_uevent(&priv->kobj, KOBJ_ADD); return 0; out_unregister: --- a/drivers/base/driver.c +++ b/drivers/base/driver.c @@ -185,8 +185,12 @@ int driver_register(struct device_driver if (ret) return ret; ret = driver_add_groups(drv, drv->groups); - if (ret) + if (ret) { bus_remove_driver(drv); + return ret; + } + kobject_uevent(&drv->p->kobj, KOBJ_ADD); + return ret; } EXPORT_SYMBOL_GPL(driver_register); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/