Skip to content

Commit

Permalink
[SCSI] bsg: replace kobject_get with blk_get_queue
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: James Bottomley <[email protected]>
  • Loading branch information
fujita authored and James Bottomley committed Apr 18, 2008
1 parent d45ac4f commit c3ff1b9
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions block/bsg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c3ff1b9

Please sign in to comment.