Patchwork nui.c error handling

login
register
mail settings
Submitter Dan Carpenter
Date April 8, 2009, 11:39 a.m.
Message ID <alpine.DEB.2.00.0904081437400.32632@bicker>
Download mbox | patch
Permalink /patch/25726/
State Accepted
Delegated to: David Miller
Headers show

Comments

Dan Carpenter - April 8, 2009, 11:39 a.m.
platform_device_register_simple() returns ERR_PTR(), not NULL, if an error 
occurs.

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
David Miller - April 8, 2009, 10:44 p.m.
From: Dan Carpenter <error27@gmail.com>
Date: Wed, 8 Apr 2009 14:39:28 +0300 (EAT)

> platform_device_register_simple() returns ERR_PTR(), not NULL, if an error 
> occurs.
> 
> Found by smatch (http://repo.or.cz/w/smatch.git).  Compile tested.
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>

Applied, thanks.
--
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/niu.c	2009-04-07 21:59:22.000000000 +0300
+++ devel/drivers/net/niu.c	2009-04-07 22:00:45.000000000 +0300
@@ -8757,7 +8757,7 @@ 
 
 	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++) {