c2port: fix device_create() return value check

Use IS_ERR() instead of comparing to NULL.

[[email protected]: preserve the error code]
Signed-off-by: Jani Nikula <[email protected]>
Cc: Vegard Nossum <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Jani Nikula 2010-03-23 13:35:27 -07:00 • committed by Linus Torvalds
commit 8c363afe94

View file

@ -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);