[PATCH] ata: fix platform_device_register_simple() error check
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 15 Dec 2006 21:08:51 +0000 (13:08 -0800)
committerJeff Garzik <jeff@garzik.org>
Sat, 16 Dec 2006 15:45:28 +0000 (10:45 -0500)
The return value of platform_device_register_simple() should be checked
by IS_ERR().

Cc: Jeff Garzik <jgarzik@pobox.com>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/ata/pata_legacy.c
drivers/ata/pata_qdi.c
drivers/ata/pata_winbond.c

index c7d1738e4e696630ed73605728ddec1b2037e820..e7bf9d89c8ee339c002dbc4dde38aab1f718ebbd 100644 (file)
@@ -698,8 +698,10 @@ static __init int legacy_init_one(int port, unsigned long io, unsigned long ctrl
                goto fail_io;
 
        pdev = platform_device_register_simple(DRV_NAME, nr_legacy_host, NULL, 0);
-       if (pdev == NULL)
+       if (IS_ERR(pdev)) {
+               ret = PTR_ERR(pdev);
                goto fail_dev;
+       }
 
        if (ht6560a & mask) {
                ops = &ht6560a_port_ops;
index 36f621abc390729a3d143bb4b5cf06eeab87ca4f..afc0d990e7d6debecea9da3768e39cdc5c2e8364 100644 (file)
@@ -247,8 +247,8 @@ static __init int qdi_init_one(unsigned long port, int type, unsigned long io, i
         */
 
        pdev = platform_device_register_simple(DRV_NAME, nr_qdi_host, NULL, 0);
-       if (pdev == NULL)
-               return -ENOMEM;
+       if (IS_ERR(pdev))
+               return PTR_ERR(pdev);
 
        memset(&ae, 0, sizeof(struct ata_probe_ent));
        INIT_LIST_HEAD(&ae.node);
index 3ea345cde52ed1ceaf595c9ffff1decb16ddb329..5d1f518e1cc7ab1d119e08f372004a28afbc840c 100644 (file)
@@ -206,8 +206,8 @@ static __init int winbond_init_one(unsigned long port)
                         */
 
                        pdev = platform_device_register_simple(DRV_NAME, nr_winbond_host, NULL, 0);
-                       if (pdev == NULL)
-                               return -ENOMEM;
+                       if (IS_ERR(pdev))
+                               return PTR_ERR(pdev);
 
                        memset(&ae, 0, sizeof(struct ata_probe_ent));
                        INIT_LIST_HEAD(&ae.node);