Skip to contentSkip to conversation

linux-2.6.18/scsiback: fix initialization error paths

PATCH New Jan Beulich 1 participant 1 message Jan 6, 2012 Xen hypervisor interface

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 linux-2.6.18/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).

drivers/xen/scsiback/scsiback.c +3 -5
@@ -700,7 +700,7 @@ static int __init scsiback_init(void)
 		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 @@ static int __init scsiback_init(void)
 		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);
drivers/xen/scsiback/xenbus.c +2 -2
@@ -363,12 +363,12 @@ static DEFINE_XENBUS_DRIVER(scsiback, ,
 	.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);
 }

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).

drivers/xen/scsiback/scsiback.c +3 -5
@@ -700,7 +700,7 @@ static int __init scsiback_init(void)
 		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 @@ static int __init scsiback_init(void)
 		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);
drivers/xen/scsiback/xenbus.c +2 -2
@@ -363,12 +363,12 @@ static DEFINE_XENBUS_DRIVER(scsiback, ,
 	.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-devel mailing list
[email protected]
http://lists.xensource.com/xen-devel