phy: error handling for platform_device_register_simple()
authorDan Carpenter <error27@gmail.com>
Sat, 11 Apr 2009 08:52:29 +0000 (01:52 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 11 Apr 2009 08:52:29 +0000 (01:52 -0700)
platform_device_register_simple() returns ERR_PTR() and not NULL.

Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/fixed.c

index cf24cc34debe5d44df793e9d5945fc745a1e5d07..e7070515d2e360d68f25c76f0795f0f1943ab323 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/mii.h>
 #include <linux/phy.h>
 #include <linux/phy_fixed.h>
+#include <linux/err.h>
 
 #define MII_REGS_NUM 29
 
@@ -207,8 +208,8 @@ static int __init fixed_mdio_bus_init(void)
        int ret;
 
        pdev = platform_device_register_simple("Fixed MDIO bus", 0, NULL, 0);
-       if (!pdev) {
-               ret = -ENOMEM;
+       if (IS_ERR(pdev)) {
+               ret = PTR_ERR(pdev);
                goto err_pdev;
        }