提交 8c363afe 编写于 作者: J Jani Nikula 提交者: Linus Torvalds

c2port: fix device_create() return value check

Use IS_ERR() instead of comparing to NULL.

[akpm@linux-foundation.org: preserve the error code]
Signed-off-by: NJani Nikula <ext-jani.1.nikula@nokia.com>
Cc: Vegard Nossum <vegard.nossum@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 cb532375
......@@ -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);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册