[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20080602204631.f11c5891.krzysztof.h1@poczta.fm>
Date: Mon, 2 Jun 2008 20:46:31 +0200
From: Krzysztof Helt <krzysztof.h1@...zta.fm>
To: netdev@...r.kernel.org
Subject: [PATCH] correct handling of return value from
platform_device_register_simple
From: Krzysztof Helt <krzysztof.h1@...pl>
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 <krzysztof.h1@...pl>
---
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
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists