Skip to content

Commit 58f3e0a

Browse files
error27davem330
authored andcommitted
niu: Fix error handling
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent b5e86db commit 58f3e0a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/niu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9542,7 +9542,7 @@ static struct niu_parent * __devinit niu_new_parent(struct niu *np,
95429542

95439543
plat_dev = platform_device_register_simple("niu", niu_parent_index,
95449544
NULL, 0);
9545-
if (!plat_dev)
9545+
if (IS_ERR(plat_dev))
95469546
return NULL;
95479547

95489548
for (i = 0; attr_name(niu_parent_attributes[i]); i++) {

0 commit comments

Comments
 (0)