Commit 94f060bd authored by Akinobu Mita's avatar Akinobu Mita Committed by 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: default avatarAkinobu Mita <akinobu.mita@gmail.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarDave Airlie <airlied@linux.ie>
parent 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%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment