The patch titled Driver core: Fix cleanup when failing device_add(). has been added to the -mm tree. Its filename is driver-core-fix-cleanup-when-failing-device_add.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: Driver core: Fix cleanup when failing device_add(). From: Cornelia Huck <cornelia.huck@xxxxxxxxxx> - Don't call cleanup_device_parent() if we didn't call setup_parent(). - dev->kobj.parent may be NULL when cleanup_device_parent() is called, so we need to handle glue_dir == NULL in cleanup_glue_dir(). Signed-off-by: Cornelia Huck <cornelia.huck@xxxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Cc: Kay Sievers <kay.sievers@xxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- drivers/base/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff -puN drivers/base/core.c~driver-core-fix-cleanup-when-failing-device_add drivers/base/core.c --- a/drivers/base/core.c~driver-core-fix-cleanup-when-failing-device_add +++ a/drivers/base/core.c @@ -622,7 +622,8 @@ static struct kobject *get_device_parent static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir) { /* see if we live in a "glue" directory */ - if (!dev->class || glue_dir->kset != &dev->class->class_dirs) + if (!glue_dir || !dev->class || + glue_dir->kset != &dev->class->class_dirs) return; kobject_put(glue_dir); @@ -781,7 +782,7 @@ int device_add(struct device *dev) dev = get_device(dev); if (!dev || !strlen(dev->bus_id)) { error = -EINVAL; - goto Error; + goto Done; } pr_debug("device: '%s': %s\n", dev->bus_id, __FUNCTION__); _ Patches currently in -mm which might be from cornelia.huck@xxxxxxxxxx are driver-core-fix-cleanup-when-failing-device_add.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