summaryrefslogtreecommitdiffstats
path: root/block/bsg.c
diff options
context:
space:
mode:
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2008-03-31 03:03:39 +0200
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-04-18 18:47:49 +0200
commitc3ff1b90d8924dd1c55c3b56a79bfc563ace4a42 (patch)
treec012845d2203b81afd4b2dade9dc9f0d453da906 /block/bsg.c
parent[SCSI] bsg: takes a ref to struct device in fops->open (diff)
downloadlinux-c3ff1b90d8924dd1c55c3b56a79bfc563ace4a42.tar.xz
linux-c3ff1b90d8924dd1c55c3b56a79bfc563ace4a42.zip
[SCSI] bsg: replace kobject_get with blk_get_queue
Both takes a ref to a queue. But blk_get_queue checks QUEUE_FLAG_DEAD and is more appropriate interface here. Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to '')
-rw-r--r--block/bsg.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/block/bsg.c b/block/bsg.c
index d8e0cb8dd6be..e2c65a150a79 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -740,16 +740,21 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
struct file *file)
{
struct bsg_device *bd;
+ int ret;
#ifdef BSG_DEBUG
unsigned char buf[32];
#endif
+ ret = blk_get_queue(rq);
+ if (ret)
+ return ERR_PTR(-ENXIO);
bd = bsg_alloc_device();
- if (!bd)
+ if (!bd) {
+ blk_put_queue(rq);
return ERR_PTR(-ENOMEM);
+ }
bd->queue = rq;
- kobject_get(&rq->kobj);
bsg_set_block(bd, file);
atomic_set(&bd->ref_count, 1);