Re: [PATCH 1/2] parisc: processor.c, fix bloated stack frame

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 23, 2009 at 01:18:26PM -0400, Kyle McMartin wrote:
> From: Kyle McMartin <kyle@xxxxxxxxxxxxxxxxx>
> 
> The pa_pdc_cell struct can be kmalloc'd, so do that instead.
> 
> Signed-off-by: Kyle McMartin <kyle@xxxxxxxxxxx>
> ---
>  arch/parisc/kernel/processor.c |   16 +++++++++++-----
>  1 files changed, 11 insertions(+), 5 deletions(-)
> 
> diff --git a/arch/parisc/kernel/processor.c b/arch/parisc/kernel/processor.c
> index 1ca69a8..c8fb61e 100644
> --- a/arch/parisc/kernel/processor.c
> +++ b/arch/parisc/kernel/processor.c
> @@ -120,22 +120,28 @@ static int __cpuinit processor_probe(struct parisc_device *dev)
>  	if (is_pdc_pat()) {
>  		ulong status;
>  		unsigned long bytecnt;
> -	        pdc_pat_cell_mod_maddr_block_t pa_pdc_cell;
> +	        pdc_pat_cell_mod_maddr_block_t *pa_pdc_cell;
>  #undef USE_PAT_CPUID
>  #ifdef USE_PAT_CPUID
>  		struct pdc_pat_cpu_num cpu_info;
>  #endif
>  
> +		pa_pdc_cell = kmalloc(sizeof (*pa_pdc_cell), GFP_KERNEL);
> +		if (!pa_pdc_cell)
> +			panic("couldn't allocate memory for PDC_PAT_CELL!");

Even though we are never going to hit this panic, could this be coded
so processor_probe just fails for that PDC device?

ie printk and return 1 like some of the code right above it does.

I really dislike adding panic() calls if they are easy to avoid.

The rest looks fine to me.

thanks
grant

> +
>  		status = pdc_pat_cell_module(&bytecnt, dev->pcell_loc,
> -			dev->mod_index, PA_VIEW, &pa_pdc_cell);
> +			dev->mod_index, PA_VIEW, pa_pdc_cell);
>  
>  		BUG_ON(PDC_OK != status);
>  
>  		/* verify it's the same as what do_pat_inventory() found */
> -		BUG_ON(dev->mod_info != pa_pdc_cell.mod_info);
> -		BUG_ON(dev->pmod_loc != pa_pdc_cell.mod_location);
> +		BUG_ON(dev->mod_info != pa_pdc_cell->mod_info);
> +		BUG_ON(dev->pmod_loc != pa_pdc_cell->mod_location);
> +
> +		txn_addr = pa_pdc_cell->mod[0];   /* id_eid for IO sapic */
>  
> -		txn_addr = pa_pdc_cell.mod[0];   /* id_eid for IO sapic */
> +		kfree(pa_pdc_cell);
>  
>  #ifdef USE_PAT_CPUID
>  /* We need contiguous numbers for cpuid. Firmware's notion
> -- 
> 1.6.3.1
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-parisc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux SoC]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux