Re: [PATCH 2/2] mtd: cfi_cmdset_0002: fix delayed error detection on HyperFlash

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

 



On 10/06/2019 11:54 PM, Tokunori Ikegami wrote:

>> The commit 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling
>> status register") added checking for the status register error bits into
>> chip_good() to only return 1 if these bits are zero. Unfortunately, this
>> means that polling using chip_good() always reaches a time-out condition
>> when erase or program failure bits are set. I think the status register
>> error checking should be fully delegated to cfi_check_err_status() that
>> should return whether any error bits were set or not...
>>
>> Fixes: 4844ef80305d ("mtd: cfi_cmdset_0002: Add support for polling status register")
>> Signed-off-by: Sergei Shtylyov <sergei.shtylyov@xxxxxxxxxxxxxxxxxx>
>>
>> ---
>>   drivers/mtd/chips/cfi_cmdset_0002.c |   55 +++++++++++++++++++-----------------
>>   1 file changed, 30 insertions(+), 25 deletions(-)
>>
>> Index: linux/drivers/mtd/chips/cfi_cmdset_0002.c
>> ===================================================================
>> --- linux.orig/drivers/mtd/chips/cfi_cmdset_0002.c
>> +++ linux/drivers/mtd/chips/cfi_cmdset_0002.c
[...]
>> @@ -155,7 +155,9 @@ static void cfi_check_err_status(struct
>>           if (chipstatus & CFI_SR_SLSB)
>>               pr_err("%s sector write protected, status %lx\n",
>>                      map->name, chipstatus);
>> +        return 1;
> Is it okay to be returned 1 for the errors CFI_SR_WBASB and CFI_SR_SLSB also?
> Before the change only CFI_Well, SR_ESB and CFI_SR_PSB were checked by chip_good().

   Well, pr_err() calls above spoke for themselves: all bitmask 0x3a was considered
the error bits. But I can change that back to just ESB/PSB if preferred.

>>       }
>> +    return 0;
>>   }
>>     /* #define DEBUG_CFI_FEATURES */
[...]
>>   @@ -1974,12 +1974,17 @@ static int __xipram do_write_buffer_wait
>>            */
>>           if (time_after(jiffies, timeo) &&
>>               !chip_good(map, chip, adr, datum)) {
>> +            pr_warn("MTD %s(): software timeout, address:0x%.8lx.\n",
>> +                __func__, adr);
> 
> Is there any reason to change the message to use pr_warn() from pr_err()?

   Yes, all the other timeout messages use printk(KERN_WARNING, ...);

> In the past it was changed to use pr_err() from printk(KERN_WARNING) as mentioned by the maintainer.

   Oh, OK, I'll switch back if so...

> 
> Regards,
> Ikegami
[...]

   It's better to remove the diff you're not commenting to.

MBR, Sergei

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/



[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux