lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1352283494-31200-6-git-send-email-gaowanlong@cn.fujitsu.com>
Date:	Wed, 7 Nov 2012 18:18:14 +0800
From:	Wanlong Gao <gaowanlong@...fujitsu.com>
To:	linux-kernel@...r.kernel.org
Cc:	"James E.J. Bottomley" <JBottomley@...allels.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Rusty Russell <rusty@...tcorp.com.au>,
	linux-scsi@...r.kernel.org, kvm@...r.kernel.org,
	Wanlong Gao <gaowanlong@...fujitsu.com>
Subject: [PATCH 5/5] virtio-scsi: tidy up the goto label in init()

Tidy up the goto label in init(), and remove the useless
NULL pointer assignment.

Cc: James E.J. Bottomley <JBottomley@...allels.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Rusty Russell <rusty@...tcorp.com.au>
Cc: linux-scsi@...r.kernel.org
Cc: kvm@...r.kernel.org
Signed-off-by: Wanlong Gao <gaowanlong@...fujitsu.com>
---
 drivers/scsi/virtio_scsi.c | 28 +++++++++++-----------------
 1 file changed, 11 insertions(+), 17 deletions(-)

diff --git a/drivers/scsi/virtio_scsi.c b/drivers/scsi/virtio_scsi.c
index fc05240..afee1d4 100644
--- a/drivers/scsi/virtio_scsi.c
+++ b/drivers/scsi/virtio_scsi.c
@@ -793,13 +793,13 @@ static int __init init(void)
 	virtscsi_wq = alloc_workqueue("virtio-scsi", 0, 0);
 	if (!virtscsi_wq) {
 		pr_err("alloc_workqueue() for virtscsi_wq failed\n");
-		goto error;
+		goto workqueue_failed;
 	}
 
 	virtscsi_cmd_cache = KMEM_CACHE(virtio_scsi_cmd, 0);
 	if (!virtscsi_cmd_cache) {
 		pr_err("kmem_cache_create() for virtscsi_cmd_cache failed\n");
-		goto error;
+		goto kmem_cache_failed;
 	}
 
 
@@ -808,27 +808,21 @@ static int __init init(void)
 					 virtscsi_cmd_cache);
 	if (!virtscsi_cmd_pool) {
 		pr_err("mempool_create() for virtscsi_cmd_pool failed\n");
-		goto error;
+		goto mempool_failed;
 	}
 	ret = register_virtio_driver(&virtio_scsi_driver);
 	if (ret < 0)
-		goto error;
+		goto register_failed;
 
 	return 0;
 
-error:
-	if (virtscsi_cmd_pool) {
-		mempool_destroy(virtscsi_cmd_pool);
-		virtscsi_cmd_pool = NULL;
-	}
-	if (virtscsi_cmd_cache) {
-		kmem_cache_destroy(virtscsi_cmd_cache);
-		virtscsi_cmd_cache = NULL;
-	}
-	if (virtscsi_wq) {
-		destroy_workqueue(virtscsi_wq);
-		virtscsi_wq = NULL;
-	}
+register_failed:
+	mempool_destroy(virtscsi_cmd_pool);
+mempool_failed:
+	kmem_cache_destroy(virtscsi_cmd_cache);
+kmem_cache_failed:
+	destroy_workqueue(virtscsi_wq);
+workqueue_failed:
 	return ret;
 }
 
-- 
1.8.0

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ