Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=6826ee4fdbe24c7aab56ce833ef94be81d190587
Commit:     6826ee4fdbe24c7aab56ce833ef94be81d190587
Parent:     d73f5222a618a91452d41c29f5996ce3d9c63673
Author:     James Bottomley <[EMAIL PROTECTED]>
AuthorDate: Fri Jul 20 16:50:10 2007 -0500
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Sat Jul 21 08:53:33 2007 -0500

    [SCSI] bsg: fix bsg_register_queue error path
    
    unfortunately, if IS_ERR(class_dev) is true, that means class_dev isn't
    null and the check in the error leg is pointless ... it's also asking
    for trouble to request unregistration of a device we haven't actually
    created (although it works currently).  Fix by using explicit gotos and
    unregisters.
    
    Acked-by: FUJITA Tomonori <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
---
 block/bsg.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index 4e0be1b..0e3d5d4 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -993,7 +993,7 @@ retry:
        if (q->kobj.sd) {
                ret = sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
                if (ret)
-                       goto err;
+                       goto err_unregister;
        }
 
        list_add_tail(&bcd->list, &bsg_class_list);
@@ -1001,9 +1001,10 @@ retry:
 
        mutex_unlock(&bsg_mutex);
        return 0;
+
+err_unregister:
+       class_device_unregister(class_dev);
 err:
-       if (class_dev)
-               class_device_destroy(bsg_class, MKDEV(bsg_major, bcd->minor));
        mutex_unlock(&bsg_mutex);
        return ret;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to