All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] bsg: fix initialization error handling bugs
@ 2007-07-17 10:08 FUJITA Tomonori
  2007-07-17 10:08 ` [PATCH 2/4] bsg: device hash table cleanup FUJITA Tomonori
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: FUJITA Tomonori @ 2007-07-17 10:08 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-scsi, akpm, tomof

This fixes the following bugs and cleans up the initialization code:

- cdev_del is missing.
- unregister_chrdev_region should be used instead of unregister_chrdev.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 block/bsg.c |   38 ++++++++++++++++++--------------------
 1 files changed, 18 insertions(+), 20 deletions(-)

diff --git a/block/bsg.c b/block/bsg.c
index cdb00e5..b253784 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -1057,39 +1057,37 @@ static int __init bsg_init(void)
 
 	bsg_class = class_create(THIS_MODULE, "bsg");
 	if (IS_ERR(bsg_class)) {
-		kmem_cache_destroy(bsg_cmd_cachep);
-		return PTR_ERR(bsg_class);
+		ret = PTR_ERR(bsg_class);
+		goto destroy_kmemcache;
 	}
 
 	ret = alloc_chrdev_region(&devid, 0, BSG_MAX_DEVS, "bsg");
-	if (ret) {
-		kmem_cache_destroy(bsg_cmd_cachep);
-		class_destroy(bsg_class);
-		return ret;
-	}
+	if (ret)
+		goto destroy_bsg_class;
 
 	bsg_major = MAJOR(devid);
 
 	cdev_init(&bsg_cdev, &bsg_fops);
 	ret = cdev_add(&bsg_cdev, MKDEV(bsg_major, 0), BSG_MAX_DEVS);
-	if (ret) {
-		kmem_cache_destroy(bsg_cmd_cachep);
-		class_destroy(bsg_class);
-		unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS);
-		return ret;
-	}
+	if (ret)
+		goto unregister_chrdev;
 
 	ret = scsi_register_interface(&bsg_intf);
-	if (ret) {
-		printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret);
-		kmem_cache_destroy(bsg_cmd_cachep);
-		class_destroy(bsg_class);
-		unregister_chrdev(bsg_major, "bsg");
-		return ret;
-	}
+	if (ret)
+		goto remove_cdev;
 
 	printk(KERN_INFO "%s loaded (major %d)\n", bsg_version, bsg_major);
 	return 0;
+remove_cdev:
+	printk(KERN_ERR "bsg: failed register scsi interface %d\n", ret);
+	cdev_del(&bsg_cdev);
+unregister_chrdev:
+	unregister_chrdev_region(MKDEV(bsg_major, 0), BSG_MAX_DEVS);
+destroy_bsg_class:
+	class_destroy(bsg_class);
+destroy_kmemcache:
+	kmem_cache_destroy(bsg_cmd_cachep);
+	return ret;
 }
 
 MODULE_AUTHOR("Jens Axboe");
-- 
1.4.3.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 4/4] bsg: Kconfig updates
@ 2007-07-09 13:02 FUJITA Tomonori
  0 siblings, 0 replies; 7+ messages in thread
From: FUJITA Tomonori @ 2007-07-09 13:02 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-scsi, tomof

This updates bsg entry in Kconfig:

- bsg supports sg v4
- bsg depends on SCSI
- it might be better to mark it experimental for a while

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 block/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/Kconfig b/block/Kconfig
index 4d1cd1b..22dc027 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -53,9 +53,10 @@ endif
 
 config BLK_DEV_BSG
 	bool "Block layer SG support"
+	depends on SCSI && EXPERIMENTAL
 	default y
 	---help---
-	Saying Y here will enable generic SG (SCSI generic) v3
+	Saying Y here will enable generic SG (SCSI generic) v4
 	support for any block device.
 
 source block/Kconfig.iosched
-- 
1.4.4.4


^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [PATCH 4/4] bsg: Kconfig updates
@ 2007-06-08 15:12 FUJITA Tomonori
  0 siblings, 0 replies; 7+ messages in thread
From: FUJITA Tomonori @ 2007-06-08 15:12 UTC (permalink / raw)
  To: jens.axboe; +Cc: linux-scsi

- bsg supports sg v4
- bsg depends on SCSI
- it might be better to mark it experimental for a while

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
---
 block/Kconfig |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/block/Kconfig b/block/Kconfig
index 4d1cd1b..22dc027 100644
--- a/block/Kconfig
+++ b/block/Kconfig
@@ -53,9 +53,10 @@ endif
 
 config BLK_DEV_BSG
 	bool "Block layer SG support"
+	depends on SCSI && EXPERIMENTAL
 	default y
 	---help---
-	Saying Y here will enable generic SG (SCSI generic) v3
+	Saying Y here will enable generic SG (SCSI generic) v4
 	support for any block device.
 
 source block/Kconfig.iosched
-- 
1.4.3.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2007-07-17 10:23 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-07-17 10:08 [PATCH 1/4] bsg: fix initialization error handling bugs FUJITA Tomonori
2007-07-17 10:08 ` [PATCH 2/4] bsg: device hash table cleanup FUJITA Tomonori
2007-07-17 10:08 ` [PATCH 3/4] bsg: minor cleanup FUJITA Tomonori
2007-07-17 10:08 ` [PATCH 4/4] bsg: Kconfig updates FUJITA Tomonori
2007-07-17 10:22   ` Jens Axboe
  -- strict thread matches above, loose matches on Subject: below --
2007-07-09 13:02 FUJITA Tomonori
2007-06-08 15:12 FUJITA Tomonori

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.