This patch reduces stack usage in megasas_probe_one() from to 2200 to 156. A patched version of gcc 3.4.3 with -fno-unit-at-a-time disabled was used on i386 platform. Signed-off-by: Yum Rayan <yum.rayan@xxxxxxxxx> --- linux-2.6.12-rc2-mm3.a/drivers/scsi/megaraid/megaraid_sas.c 2005-04-14 22:15:44.000000000 -0700 +++ linux-2.6.12-rc2-mm3.b/drivers/scsi/megaraid/megaraid_sas.c 2005-04-20 00:26:01.000000000 -0700 @@ -731,7 +731,7 @@ struct megasas_register_set* reg_set; struct megasas_cmd* cmd; - struct megasas_ctrl_info ctrl_info; + struct megasas_ctrl_info *ctrl_info; struct megasas_init_frame* init_frame; struct megasas_init_queue_info* initq_info; @@ -846,15 +846,19 @@ megasas_return_cmd( instance, cmd ); + ctrl_info = kmalloc(sizeof(struct megasas_ctrl_info), GFP_KERNEL); + /* * Gather misc FW related information */ - if (!megasas_get_ctrl_info( instance, &ctrl_info )) - instance->max_sectors_per_req = ctrl_info.max_request_size; + if (ctrl_info && !megasas_get_ctrl_info( instance, ctrl_info )) + instance->max_sectors_per_req = ctrl_info->max_request_size; else instance->max_sectors_per_req = instance->max_num_sge * PAGE_SIZE / 512; + kfree(ctrl_info); + return 0; fail_fw_init: - : send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html