aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 12d69d7c8577..749c9c7fc2e1 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -469,6 +469,7 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
469 cmd = scsi_pool_alloc_command(shost->cmd_pool, gfp_mask); 469 cmd = scsi_pool_alloc_command(shost->cmd_pool, gfp_mask);
470 if (!cmd) { 470 if (!cmd) {
471 scsi_put_host_cmd_pool(gfp_mask); 471 scsi_put_host_cmd_pool(gfp_mask);
472 shost->cmd_pool = NULL;
472 return -ENOMEM; 473 return -ENOMEM;
473 } 474 }
474 list_add(&cmd->list, &shost->free_list); 475 list_add(&cmd->list, &shost->free_list);
@@ -481,6 +482,13 @@ int scsi_setup_command_freelist(struct Scsi_Host *shost)
481 */ 482 */
482void scsi_destroy_command_freelist(struct Scsi_Host *shost) 483void scsi_destroy_command_freelist(struct Scsi_Host *shost)
483{ 484{
485 /*
486 * If cmd_pool is NULL the free list was not initialized, so
487 * do not attempt to release resources.
488 */
489 if (!shost->cmd_pool)
490 return;
491
484 while (!list_empty(&shost->free_list)) { 492 while (!list_empty(&shost->free_list)) {
485 struct scsi_cmnd *cmd; 493 struct scsi_cmnd *cmd;
486 494