Skip to content

Commit

Permalink
c2port: fix device_create() return value check
Browse files Browse the repository at this point in the history
Use IS_ERR() instead of comparing to NULL.

[akpm@linux-foundation.org: preserve the error code]
Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Jani Nikula authored and Linus Torvalds committed Mar 24, 2010
1 parent cb53237 commit 8c363af
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/misc/c2port/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -912,8 +912,8 @@ struct c2port_device *c2port_device_register(char *name,

c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
"c2port%d", id);
if (unlikely(!c2dev->dev)) {
ret = -ENOMEM;
if (unlikely(IS_ERR(c2dev->dev))) {
ret = PTR_ERR(c2dev->dev);
goto error_device_create;
}
dev_set_drvdata(c2dev->dev, c2dev);
Expand Down

0 comments on commit 8c363af

Please sign in to comment.