[PATCH 1/3] TILER: Move dma_alloc_coherent call to tiler init

Tim Gardner tim.gardner at canonical.com
Thu Jul 15 14:00:48 UTC 2010


On 07/12/2010 09:34 PM, Bryan Wu wrote:
> On 07/13/2010 11:22 AM, Bryan Wu wrote:
>> From: David Sin<davidsin at ti.com>
>>
>> Instead of allocating and freeing PAT page array
>> memory each time, allocate 128k upfront and reuse the
>> memory.  This will avoid the possibilty of not being
>> able to obtain the memory after driver initialization.
>>
>> Signed-off-by: David Sin<davidsin at ti.com>
>> ---
>>   drivers/media/video/tiler/tiler.c |   27 +++++++++++++++------------
>>   1 files changed, 15 insertions(+), 12 deletions(-)
>>
>
> [snip]
>
>>
>> +	/* Array of physical pages for PAT programming, which must be a 16-byte
>> +	   aligned physical address
>> +	*/
>> +	dmac_va = dma_alloc_coherent(NULL, TILER_WIDTH * TILER_HEIGHT *
>> +					sizeof(*dmac_va),&dmac_pa, GFP_ATOMIC);
>> +	if (!dmac_va)
>> +		return -ENOMEM;
>> +
>
> Returning -ENOMEM is not enough here. IMHO, at least it should deinit
> sita_init(). Or just follow the error exit path.
>
> Thanks,
> -Bryan
>

Eh? I think this looks OK. If you can't allocate DMA memory, then you're 
pretty much screwed and can do nothing else but exit.

applied
-- 
Tim Gardner tim.gardner at canonical.com




More information about the kernel-team mailing list