aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid/megaraid_sas.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/scsi/megaraid/megaraid_sas.c')
-rw-r--r--drivers/scsi/megaraid/megaraid_sas.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/drivers/scsi/megaraid/megaraid_sas.c b/drivers/scsi/megaraid/megaraid_sas.c
index b7f2e613c903..ebb948c016bb 100644
--- a/drivers/scsi/megaraid/megaraid_sas.c
+++ b/drivers/scsi/megaraid/megaraid_sas.c
@@ -1636,15 +1636,13 @@ static int megasas_alloc_cmds(struct megasas_instance *instance)
1636 * Allocate the dynamic array first and then allocate individual 1636 * Allocate the dynamic array first and then allocate individual
1637 * commands. 1637 * commands.
1638 */ 1638 */
1639 instance->cmd_list = kmalloc(sizeof(struct megasas_cmd *) * max_cmd, 1639 instance->cmd_list = kcalloc(max_cmd, sizeof(struct megasas_cmd*), GFP_KERNEL);
1640 GFP_KERNEL);
1641 1640
1642 if (!instance->cmd_list) { 1641 if (!instance->cmd_list) {
1643 printk(KERN_DEBUG "megasas: out of memory\n"); 1642 printk(KERN_DEBUG "megasas: out of memory\n");
1644 return -ENOMEM; 1643 return -ENOMEM;
1645 } 1644 }
1646 1645
1647 memset(instance->cmd_list, 0, sizeof(struct megasas_cmd *) * max_cmd);
1648 1646
1649 for (i = 0; i < max_cmd; i++) { 1647 for (i = 0; i < max_cmd; i++) {
1650 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd), 1648 instance->cmd_list[i] = kmalloc(sizeof(struct megasas_cmd),