[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>
This commit is contained in:
parent
d45ac4fa8f
commit
c3ff1b90d8
@ -740,16 +740,21 @@ static struct bsg_device *bsg_add_device(struct inode *inode,
|
|||||||
struct file *file)
|
struct file *file)
|
||||||
{
|
{
|
||||||
struct bsg_device *bd;
|
struct bsg_device *bd;
|
||||||
|
int ret;
|
||||||
#ifdef BSG_DEBUG
|
#ifdef BSG_DEBUG
|
||||||
unsigned char buf[32];
|
unsigned char buf[32];
|
||||||
#endif
|
#endif
|
||||||
|
ret = blk_get_queue(rq);
|
||||||
|
if (ret)
|
||||||
|
return ERR_PTR(-ENXIO);
|
||||||
|
|
||||||
bd = bsg_alloc_device();
|
bd = bsg_alloc_device();
|
||||||
if (!bd)
|
if (!bd) {
|
||||||
|
blk_put_queue(rq);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
bd->queue = rq;
|
bd->queue = rq;
|
||||||
kobject_get(&rq->kobj);
|
|
||||||
bsg_set_block(bd, file);
|
bsg_set_block(bd, file);
|
||||||
|
|
||||||
atomic_set(&bd->ref_count, 1);
|
atomic_set(&bd->ref_count, 1);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user