提交 94f060bd 编写于 作者: A Akinobu Mita 提交者: Dave Airlie

drm: fix return value check

class_create() and class_device_create() return error code as a pointer on
failure.  These return values need to be checked by IS_ERR().
Signed-off-by: NAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NDave Airlie <airlied@linux.ie>
上级 9202f325
......@@ -45,8 +45,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
int err;
class = class_create(owner, name);
if (!class) {
err = -ENOMEM;
if (IS_ERR(class)) {
err = PTR_ERR(class);
goto err_out;
}
......@@ -113,8 +113,8 @@ struct class_device *drm_sysfs_device_add(struct class *cs, drm_head_t *head)
MKDEV(DRM_MAJOR, head->minor),
&(head->dev->pdev)->dev,
"card%d", head->minor);
if (!class_dev) {
err = -ENOMEM;
if (IS_ERR(class_dev)) {
err = PTR_ERR(class_dev);
goto err_out;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册