aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/bsg.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/block/bsg.c b/block/bsg.c
index e97e3ec08ffc..c85d961ee41e 100644
--- a/block/bsg.c
+++ b/block/bsg.c
@@ -128,7 +128,8 @@ static struct bsg_command *__bsg_alloc_command(struct bsg_device *bd)
128 bc = kmem_cache_alloc(bsg_cmd_cachep, GFP_USER); 128 bc = kmem_cache_alloc(bsg_cmd_cachep, GFP_USER);
129 if (unlikely(!bc)) { 129 if (unlikely(!bc)) {
130 spin_lock_irq(&bd->lock); 130 spin_lock_irq(&bd->lock);
131 goto alloc_fail; 131 bd->queued_cmds--;
132 goto out;
132 } 133 }
133 134
134 memset(bc, 0, sizeof(*bc)); 135 memset(bc, 0, sizeof(*bc));
@@ -136,8 +137,6 @@ static struct bsg_command *__bsg_alloc_command(struct bsg_device *bd)
136 INIT_LIST_HEAD(&bc->list); 137 INIT_LIST_HEAD(&bc->list);
137 dprintk("%s: returning free cmd %p\n", bd->name, bc); 138 dprintk("%s: returning free cmd %p\n", bd->name, bc);
138 return bc; 139 return bc;
139alloc_fail:
140 bd->queued_cmds--;
141out: 140out:
142 spin_unlock_irq(&bd->lock); 141 spin_unlock_irq(&bd->lock);
143 return bc; 142 return bc;