The patch titled Return better error codes if drivers/char/raw.c module init fails has been added to the -mm tree. Its filename is return-better-error-codes-if-drivers-char-rawc-module-init-fails.patch See http://www.zip.com.au/~akpm/linux/patches/stuff/added-to-mm.txt to find out what to do about this ------------------------------------------------------ Subject: Return better error codes if drivers/char/raw.c module init fails From: Rolf Eike Beer <eike-kernel@xxxxxxxxx> Currently this module just returns 1 if anything on module init fails. Store the error code of the different function calls and return their error on problems. I'm not sure if this doesn't need even more cleanup, for example kobj_put() is called only in one error case. Signed-off-by: Rolf Eike Beer <eike-kernel@xxxxxxxxx> Cc: Greg KH <greg@xxxxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxx> --- drivers/char/raw.c | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) diff -puN drivers/char/raw.c~return-better-error-codes-if-drivers-char-rawc-module-init-fails drivers/char/raw.c --- a/drivers/char/raw.c~return-better-error-codes-if-drivers-char-rawc-module-init-fails +++ a/drivers/char/raw.c @@ -288,31 +288,35 @@ static struct cdev raw_cdev = { static int __init raw_init(void) { dev_t dev = MKDEV(RAW_MAJOR, 0); + int ret; - if (register_chrdev_region(dev, MAX_RAW_MINORS, "raw")) + ret = register_chrdev_region(dev, MAX_RAW_MINORS, "raw"); + if (ret) goto error; cdev_init(&raw_cdev, &raw_fops); - if (cdev_add(&raw_cdev, dev, MAX_RAW_MINORS)) { + ret = cdev_add(&raw_cdev, dev, MAX_RAW_MINORS); + if (ret) { + printk(KERN_ERR "error register raw device\n"); kobject_put(&raw_cdev.kobj); - unregister_chrdev_region(dev, MAX_RAW_MINORS); - goto error; + goto error_region; } raw_class = class_create(THIS_MODULE, "raw"); if (IS_ERR(raw_class)) { printk(KERN_ERR "Error creating raw class.\n"); cdev_del(&raw_cdev); - unregister_chrdev_region(dev, MAX_RAW_MINORS); - goto error; + ret = PTR_ERR(raw_class); + goto error_region; } device_create(raw_class, NULL, MKDEV(RAW_MAJOR, 0), "rawctl"); return 0; +error_region: + unregister_chrdev_region(dev, MAX_RAW_MINORS); error: - printk(KERN_ERR "error register raw device\n"); - return 1; + return ret; } static void __exit raw_exit(void) _ Patches currently in -mm which might be from eike-kernel@xxxxxxxxx are tty-remove-bogus-call-to-cdev_del.patch git-mtd.patch add-kerneldocs-for-some-functions-in-mm-memoryc.patch use-bug_onfoo-instead-of-if-foo-bug-in-include-asm-i386-dma-mappingh.patch include-documentation-for-functions-in-drivers-base-classc.patch fix-parameter-names-in-drivers-base-classc.patch fix-kerneldoc-comments-in-kernel-timerc.patch fix-kerneldoc-comments-in-kernel-timerc-fix.patch move-valid_dma_direction-from-x86_64-to-generic-code.patch move-valid_dma_direction-from-x86_64-to-generic-code-fix.patch use-valid_dma_direction-in-include-asm-i386-dma-mappingh.patch cdev-documentation-was-drop-second-arg-of-unregister_chrdev.patch return-better-error-codes-if-drivers-char-rawc-module-init-fails.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