diff options
author | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-06-13 15:05:39 +1000 |
---|---|---|
committer | Stephen Rothwell <sfr@canb.auug.org.au> | 2008-06-13 15:14:51 +1000 |
commit | 1f26ca543b5ef0f07e1f97fcf7a8cae4430a65c7 (patch) | |
tree | c58739d44ac5849f1e29c964415baaf987c9e548 /block | |
parent | 7c3cc54816f8f7cca66264b98dc8ef5ad43b6c7b (diff) | |
parent | 222576baf968a64ac0243af5d0fc2bb3538ab96b (diff) |
Merge commit 'scsi/master'
Diffstat (limited to 'block')
-rw-r--r-- | block/bsg.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/block/bsg.c b/block/bsg.c index a8eb6092814e..cfcf73706dcb 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -724,8 +724,13 @@ static int bsg_put_device(struct bsg_device *bd) mutex_lock(&bsg_mutex); do_free = atomic_dec_and_test(&bd->ref_count); - if (!do_free) + if (!do_free) { + mutex_unlock(&bsg_mutex); goto out; + } + + hlist_del(&bd->dev_list); + mutex_unlock(&bsg_mutex); dprintk("%s: tearing down\n", bd->name); @@ -741,10 +746,8 @@ static int bsg_put_device(struct bsg_device *bd) */ ret = bsg_complete_all_commands(bd); - hlist_del(&bd->dev_list); kfree(bd); out: - mutex_unlock(&bsg_mutex); kref_put(&q->bsg_dev.ref, bsg_kref_release_function); if (do_free) blk_put_queue(q); |