Skip to contentSkip to conversation

error handling for platform_device_register_simple()

PATCH New Dan Carpenter 1 participant 1 message Apr 9, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 error handling for platform_device_register_simple()

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

drivers/net/phy/fixed.c +2 -2
@@ -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;
 	}