]> err.no Git - linux-2.6/commitdiff
[PATCH] tlclk: fix platform_device_register_simple() error check
authorAkinobu Mita <akinobu.mita@gmail.com>
Sat, 25 Nov 2006 19:09:35 +0000 (11:09 -0800)
committerLinus Torvalds <torvalds@woody.osdl.org>
Sat, 25 Nov 2006 21:28:34 +0000 (13:28 -0800)
The return value of platform_device_register_simple() should be checked by
IS_ERR().

This patch also fix misc_register() error case.  Because misc_register()
returns error code.

Cc: Sebastien Bouchard <sebastien.bouchard@ca.kontron.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/char/tlclk.c

index 2444a0e24b3106bedabb9f00d6dcdda5b4be81b7..244d30a03fef9d80daaf2092875361147202f61e 100644 (file)
@@ -792,15 +792,14 @@ static int __init tlclk_init(void)
        ret = misc_register(&tlclk_miscdev);
        if (ret < 0) {
                printk(KERN_ERR "tlclk: misc_register returns %d.\n", ret);
-               ret = -EBUSY;
                goto out3;
        }
 
        tlclk_device = platform_device_register_simple("telco_clock",
                                -1, NULL, 0);
-       if (!tlclk_device) {
+       if (IS_ERR(tlclk_device)) {
                printk(KERN_ERR "tlclk: platform_device_register failed.\n");
-               ret = -EBUSY;
+               ret = PTR_ERR(tlclk_device);
                goto out4;
        }