Skip to content

Commit

Permalink
niu: Fix error handling
Browse files Browse the repository at this point in the history
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Dan Carpenter authored and David S. Miller committed Apr 8, 2009
1 parent b5e86db commit 58f3e0a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9542,7 +9542,7 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np,

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++) {
Expand Down

0 comments on commit 58f3e0a

Please sign in to comment.