[PATCH] correct handling of return value from platform_device_register_simple
From: Krzysztof Helt <hidden>
Date: 2008-06-02 18:44:36
From: Krzysztof Helt <redacted> The correct way to check return value from the platform_device_register_simple is to use the IS_ERR() function. Signed-off-by: Krzysztof Helt <redacted> --- This patch was made against 2.6.26-rc2-mm1. diff -urp linux-mm1/drivers/net/niu.c linux-new/drivers/net/niu.c
--- linux-mm1/drivers/net/niu.c 2008-05-27 21:58:31.894983318 +0200
+++ linux-new/drivers/net/niu.c 2008-06-02 20:39:51.466114138 +0200@@ -8186,7 +8186,7 @@ static struct niu_parent * __devinit niu plat_dev = platform_device_register_simple("niu", niu_parent_index, NULL, 0); - if (!plat_dev) + if (IS_ERR(plat_dev)) return NULL; for (i = 0; attr_name(niu_parent_attributes[i]); i++) {
diff -urp linux-mm1/drivers/net/phy/fixed.c linux-new/drivers/net/phy/fixed.c
--- linux-mm1/drivers/net/phy/fixed.c 2008-05-27 21:57:21.406974006 +0200
+++ linux-new/drivers/net/phy/fixed.c 2008-06-02 20:32:43.506107910 +0200@@ -208,8 +208,8 @@ static int __init fixed_mdio_bus_init(vo 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; } ----------------------------------------------------------------------
Podbij Dziki Zachod!Gra strategiczna online Sprawdz >>> http://link.interia.pl/f1dff