Skip to content

Commit

Permalink
drm: fix return value check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Akinobu Mita authored and Dave Airlie committed Dec 11, 2006
1 parent 9202f32 commit 94f060b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions drivers/char/drm/drm_sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 94f060b

Please sign in to comment.