Patchwork error handling for platform_device_register_simple()

login
register
mail settings
Submitter Dan Carpenter
Date April 9, 2009, 7:55 a.m.
Message ID <alpine.DEB.2.00.0904090640170.13970@bicker>
Download mbox | patch
Permalink /patch/25772/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - April 9, 2009, 7:55 a.m.
platform_device_register_simple() returns ERR_PTR() and not NULL.

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

regards,
dan carpenter

Signed-off-by: Dan Carpenter <error27@gmail.com>

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

--- orig/drivers/net/phy/fixed.c	2009-04-09 05:53:24.000000000 +0300
+++ devel/drivers/net/phy/fixed.c	2009-04-09 05:53:52.000000000 +0300
@@ -207,8 +207,8 @@ 
 	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;
 	}