The patch titled sysdev: detect multiple driver registrations has been added to the -mm tree. Its filename is sysdev-detect-multiple-driver-registrations.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: sysdev: detect multiple driver registrations From: Ben Dooks <ben@xxxxxxxxx> I've just found how easy it is to accidentally register a sysdev_driver for two different classes. When this happens, bad things happen as the sysdev_driver structure keeps has the list entry for the driver registration. The following patch makes a WARN_ON() if this happens, although I think BUG_ON or returning -EAGAIN could also be valid responses to this. Signed-off-by: Ben Dooks <ben@xxxxxxxxx> Cc: Kay Sievers <kay.sievers@xxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/sys.c | 5 +++++ 1 file changed, 5 insertions(+) diff -puN drivers/base/sys.c~sysdev-detect-multiple-driver-registrations drivers/base/sys.c --- a/drivers/base/sys.c~sysdev-detect-multiple-driver-registrations +++ a/drivers/base/sys.c @@ -166,6 +166,11 @@ int sysdev_driver_register(struct sysdev { int err = 0; + /* Check whether this driver has already been added to a class. */ + + WARN_ON(drv->entry.next != drv->entry.prev); + WARN_ON(drv->entry.next != NULL); + mutex_lock(&sysdev_drivers_lock); if (cls && kset_get(&cls->kset)) { list_add_tail(&drv->entry, &cls->drivers); _ Patches currently in -mm which might be from ben@xxxxxxxxx are sysdev-detect-multiple-driver-registrations.patch - To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html