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: Akinobu Mita <akinobu.mita@gmail.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Dave Airlie <airlied@linux.ie>
This commit is contained in:
parent
9202f32558
commit
94f060bd0f
|
@ -45,8 +45,8 @@ struct class *drm_sysfs_create(struct module *owner, char *name)
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
class = class_create(owner, name);
|
class = class_create(owner, name);
|
||||||
if (!class) {
|
if (IS_ERR(class)) {
|
||||||
err = -ENOMEM;
|
err = PTR_ERR(class);
|
||||||
goto err_out;
|
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),
|
MKDEV(DRM_MAJOR, head->minor),
|
||||||
&(head->dev->pdev)->dev,
|
&(head->dev->pdev)->dev,
|
||||||
"card%d", head->minor);
|
"card%d", head->minor);
|
||||||
if (!class_dev) {
|
if (IS_ERR(class_dev)) {
|
||||||
err = -ENOMEM;
|
err = PTR_ERR(class_dev);
|
||||||
goto err_out;
|
goto err_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue