[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [linux-2.6.18-xen] scsiback: fix initialization error paths



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1326102860 -3600
# Node ID c3d7beacd036903e397da7cbbabbebcd59f56650
# Parent  cdbf3be3f2bd1e3988ea3f1c795e5636c0b53d4b
scsiback: fix initialization error paths

scsiback_interface_exit() must not be called upon failure of
scsiback_interface_init().

Similarly, scsiback_xenbus_unregister() shouldn't be called when
scsiback_xenbus_init() failed. With this reference to it removed, the
function can be marked __exit (and its initialization counterpart
should have been __init from the beginning).

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
---


diff -r cdbf3be3f2bd -r c3d7beacd036 drivers/xen/scsiback/scsiback.c
--- a/drivers/xen/scsiback/scsiback.c   Mon Jan 09 10:53:28 2012 +0100
+++ b/drivers/xen/scsiback/scsiback.c   Mon Jan 09 10:54:20 2012 +0100
@@ -700,7 +700,7 @@
                pending_grant_handles[i] = SCSIBACK_INVALID_HANDLE;
 
        if (scsiback_interface_init() < 0)
-               goto out_of_kmem;
+               goto out_of_memory;
 
        INIT_LIST_HEAD(&pending_free);
 
@@ -708,15 +708,13 @@
                list_add_tail(&pending_reqs[i].free_list, &pending_free);
 
        if (scsiback_xenbus_init())
-               goto out_of_xenbus;
+               goto out_interface;
 
        scsiback_emulation_init();
 
        return 0;
 
-out_of_xenbus:
-       scsiback_xenbus_unregister();
-out_of_kmem:
+out_interface:
        scsiback_interface_exit();
 out_of_memory:
        kfree(pending_reqs);
diff -r cdbf3be3f2bd -r c3d7beacd036 drivers/xen/scsiback/xenbus.c
--- a/drivers/xen/scsiback/xenbus.c     Mon Jan 09 10:53:28 2012 +0100
+++ b/drivers/xen/scsiback/xenbus.c     Mon Jan 09 10:54:20 2012 +0100
@@ -363,12 +363,12 @@
        .otherend_changed       = scsiback_frontend_changed
 );
 
-int scsiback_xenbus_init(void)
+int __init scsiback_xenbus_init(void)
 {
        return xenbus_register_backend(&scsiback_driver);
 }
 
-void scsiback_xenbus_unregister(void)
+void __exit scsiback_xenbus_unregister(void)
 {
        xenbus_unregister_driver(&scsiback_driver);
 }

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.