diff options
-rw-r--r-- | drivers/scsi/scsi.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c index e5c6f6af8765..c78b836f59dd 100644 --- a/drivers/scsi/scsi.c +++ b/drivers/scsi/scsi.c | |||
@@ -181,6 +181,18 @@ struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) | |||
181 | cmd = kmem_cache_alloc(shost->cmd_pool->cmd_slab, | 181 | cmd = kmem_cache_alloc(shost->cmd_pool->cmd_slab, |
182 | gfp_mask | shost->cmd_pool->gfp_mask); | 182 | gfp_mask | shost->cmd_pool->gfp_mask); |
183 | 183 | ||
184 | if (likely(cmd)) { | ||
185 | buf = kmem_cache_alloc(shost->cmd_pool->sense_slab, | ||
186 | gfp_mask | shost->cmd_pool->gfp_mask); | ||
187 | if (likely(buf)) { | ||
188 | memset(cmd, 0, sizeof(*cmd)); | ||
189 | cmd->sense_buffer = buf; | ||
190 | } else { | ||
191 | kmem_cache_free(shost->cmd_pool->cmd_slab, cmd); | ||
192 | cmd = NULL; | ||
193 | } | ||
194 | } | ||
195 | |||
184 | if (unlikely(!cmd)) { | 196 | if (unlikely(!cmd)) { |
185 | unsigned long flags; | 197 | unsigned long flags; |
186 | 198 | ||
@@ -197,16 +209,6 @@ struct scsi_cmnd *__scsi_get_command(struct Scsi_Host *shost, gfp_t gfp_mask) | |||
197 | memset(cmd, 0, sizeof(*cmd)); | 209 | memset(cmd, 0, sizeof(*cmd)); |
198 | cmd->sense_buffer = buf; | 210 | cmd->sense_buffer = buf; |
199 | } | 211 | } |
200 | } else { | ||
201 | buf = kmem_cache_alloc(shost->cmd_pool->sense_slab, | ||
202 | gfp_mask | shost->cmd_pool->gfp_mask); | ||
203 | if (likely(buf)) { | ||
204 | memset(cmd, 0, sizeof(*cmd)); | ||
205 | cmd->sense_buffer = buf; | ||
206 | } else { | ||
207 | kmem_cache_free(shost->cmd_pool->cmd_slab, cmd); | ||
208 | cmd = NULL; | ||
209 | } | ||
210 | } | 212 | } |
211 | 213 | ||
212 | return cmd; | 214 | return cmd; |