]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
drm: fix return value check
authorAkinobu Mita <akinobu.mita@gmail.com>
Fri, 8 Dec 2006 23:49:47 +0000 (10:49 +1100)
committerDave Airlie <airlied@linux.ie>
Mon, 11 Dec 2006 07:28:45 +0000 (18:28 +1100)
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>
drivers/char/drm/drm_sysfs.c

index ba4b8de83cf0feda86f5d126534a56fd814fd33f..cc8e2ebe128c55056b6a29ec66a060cbe7372168 100644 (file)
@@ -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;
        }