[PATCH 2/3] MTD: OneNAND: Fix loop hang when DMA error at Samsung SoCs

Kyungmin Park kmpark at infradead.org
Mon Aug 30 09:41:48 EDT 2010


On Mon, Aug 30, 2010 at 9:49 PM, Artem Bityutskiy <dedekind1 at gmail.com> wrote:
> On Fri, 2010-08-27 at 11:55 +0900, Kyungmin Park wrote:
>> From: Kyungmin Park <kyungmin.park at samsung.com>
>>
>> When DMA error occurs. it's loop hang since it can't exit the loop.
>> and it's the right DMA handling code as Spec.
>>
>> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
>> ---
>>  drivers/mtd/onenand/samsung.c |   11 +++++------
>>  1 files changed, 5 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/mtd/onenand/samsung.c b/drivers/mtd/onenand/samsung.c
>> index 05329ba..69e48d0 100644
>> --- a/drivers/mtd/onenand/samsung.c
>> +++ b/drivers/mtd/onenand/samsung.c
>> @@ -554,14 +554,13 @@ static int s5pc110_dma_ops(void *dst, void *src, size_t count, int direction)
>>
>>       do {
>>               status = readl(base + S5PC110_DMA_TRANS_STATUS);
>> +             if (status & S5PC110_DMA_TRANS_STATUS_TE) {
>> +                     writel(S5PC110_DMA_TRANS_CMD_TEC,
>> +                                     base + S5PC110_DMA_TRANS_CMD);
>> +                     return -EIO;
>> +             }
>>       } while (!(status & S5PC110_DMA_TRANS_STATUS_TD));
>>
>> -     if (status & S5PC110_DMA_TRANS_STATUS_TE) {
>> -             writel(S5PC110_DMA_TRANS_CMD_TEC, base + S5PC110_DMA_TRANS_CMD);
>> -             writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
>> -             return -EIO;
>> -     }
>> -
>>       writel(S5PC110_DMA_TRANS_CMD_TDC, base + S5PC110_DMA_TRANS_CMD);
>
> You shoule also add timeout to the loop. Forever loops are bad. Please,
> while you are on it, fix the forever loop by doing something like this:
> http://patchwork.ozlabs.org/patch/59180/
> I mean, add timeout please.

No problem, I will update this patch tomorrow.

Thank you,
Kyungmin Park
>
> --
> Best Regards,
> Artem Bityutskiy (Битюцкий Артём)
>
>
> ______________________________________________________
> Linux MTD discussion mailing list
> http://lists.infradead.org/mailman/listinfo/linux-mtd/
>



More information about the linux-mtd mailing list