diff mbox series

[RESEND,v2] mtd: spinand: read return badly if the last page has bitflips

Message ID 1561424549-784-1-git-send-email-liaoweixiong@allwinnertech.com
State Changes Requested
Delegated to: Miquel Raynal
Headers show
Series [RESEND,v2] mtd: spinand: read return badly if the last page has bitflips | expand

Commit Message

WeiXiong Liao June 25, 2019, 1:02 a.m. UTC
In case of the last page containing bitflips (ret > 0),
spinand_mtd_read() will return that number of bitflips for the last
page. But to me it looks like it should instead return max_bitflips like
it does when the last page read returns with 0.

Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
---
 drivers/mtd/nand/spi/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Greg KH June 25, 2019, 3:08 a.m. UTC | #1
On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:
> In case of the last page containing bitflips (ret > 0),
> spinand_mtd_read() will return that number of bitflips for the last
> page. But to me it looks like it should instead return max_bitflips like
> it does when the last page read returns with 0.
> 
> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
> ---
>  drivers/mtd/nand/spi/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

<formletter>

This is not the correct way to submit patches for inclusion in the
stable kernel tree.  Please read:
    https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.

</formletter>
Frieder Schrempf June 25, 2019, 7:04 a.m. UTC | #2
Hi liaoweixiong,

On 25.06.19 05:08, Greg KH wrote:
> On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:
>> In case of the last page containing bitflips (ret > 0),
>> spinand_mtd_read() will return that number of bitflips for the last
>> page. But to me it looks like it should instead return max_bitflips like
>> it does when the last page read returns with 0.
>>
>> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
>> ---
>>   drivers/mtd/nand/spi/core.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> <formletter>
> 
> This is not the correct way to submit patches for inclusion in the
> stable kernel tree.  Please read:
>      https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
> for how to do this properly.
> 
> </formletter>

FYI, you should not send the patch to stable@vger.kernel.org, but 
instead, as I said in my other reply, add the tag "Cc: 
stable@vger.kernel.org". See "Option 1" in the document Greg referred to.

Thanks,
Frieder
WeiXiong Liao June 25, 2019, 11:56 a.m. UTC | #3
Oh, i am sorry that i had misunderstanded your letter.
Thank you for your document and guidance.

On 2019/6/25 PM 3:04, Schrempf Frieder wrote:
> Hi liaoweixiong,
> 
> On 25.06.19 05:08, Greg KH wrote:
>> On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:
>>> In case of the last page containing bitflips (ret > 0),
>>> spinand_mtd_read() will return that number of bitflips for the last
>>> page. But to me it looks like it should instead return max_bitflips like
>>> it does when the last page read returns with 0.
>>>
>>> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
>>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>>> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
>>> ---
>>>   drivers/mtd/nand/spi/core.c | 2 +-
>>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> <formletter>
>>
>> This is not the correct way to submit patches for inclusion in the
>> stable kernel tree.  Please read:
>>      https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
>> for how to do this properly.
>>
>> </formletter>
> 
> FYI, you should not send the patch to stable@vger.kernel.org, but 
> instead, as I said in my other reply, add the tag "Cc: 
> stable@vger.kernel.org". See "Option 1" in the document Greg referred to.
> 
> Thanks,
> Frieder
>
Frieder Schrempf June 25, 2019, 12:04 p.m. UTC | #4
On 25.06.19 13:56, liaoweixiong wrote:
> Oh, i am sorry that i had misunderstanded your letter.

No problem ;)

> Thank you for your document and guidance.

You're welcome!

> On 2019/6/25 PM 3:04, Schrempf Frieder wrote:
>> Hi liaoweixiong,
>>
>> On 25.06.19 05:08, Greg KH wrote:
>>> On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:
>>>> In case of the last page containing bitflips (ret > 0),
>>>> spinand_mtd_read() will return that number of bitflips for the last
>>>> page. But to me it looks like it should instead return max_bitflips like
>>>> it does when the last page read returns with 0.
>>>>
>>>> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>
>>>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>>>> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>
>>>> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")
>>>> ---
>>>>    drivers/mtd/nand/spi/core.c | 2 +-
>>>>    1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> <formletter>
>>>
>>> This is not the correct way to submit patches for inclusion in the
>>> stable kernel tree.  Please read:
>>>       https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
>>> for how to do this properly.
>>>
>>> </formletter>
>>
>> FYI, you should not send the patch to stable@vger.kernel.org, but
>> instead, as I said in my other reply, add the tag "Cc:
>> stable@vger.kernel.org". See "Option 1" in the document Greg referred to.
>>
>> Thanks,
>> Frieder
>>
>
Miquel Raynal June 27, 2019, 5:06 p.m. UTC | #5
Hello,

Schrempf Frieder <frieder.schrempf@kontron.de> wrote on Tue, 25 Jun
2019 07:04:06 +0000:

> Hi liaoweixiong,
> 
> On 25.06.19 05:08, Greg KH wrote:
> > On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:  
> >> In case of the last page containing bitflips (ret > 0),
> >> spinand_mtd_read() will return that number of bitflips for the last
> >> page. But to me it looks like it should instead return max_bitflips like
> >> it does when the last page read returns with 0.
> >>
> >> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>

Please write your entire official first/last name(s)

> >> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> >> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>

I am waiting your next version with Acked-by instead of Rewieved-by
tags and Greg's comment addressed.
> >> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")

Finally, when we ask you to resend a patch, it means sending a new
version of the patch. So in the subject, you should not use the
[RESEND] keyword (which means you are sending something again exactly
as it was before, you just got ignored, for example) but instead you
should increment the version number (v3) and also write a nice
changelog after the three dashes '---' (will be ignored by Git when
applying).

I would like to queue this for the next release so if you can do it
ASAP, that would be great.

Thank you,
Miquèl
Miquel Raynal June 27, 2019, 6:17 p.m. UTC | #6
Hi Miquel,

Miquel Raynal <miquel.raynal@bootlin.com> wrote on Thu, 27 Jun 2019
19:06:44 +0200:

> Hello,
> 
> Schrempf Frieder <frieder.schrempf@kontron.de> wrote on Tue, 25 Jun
> 2019 07:04:06 +0000:
> 
> > Hi liaoweixiong,
> > 
> > On 25.06.19 05:08, Greg KH wrote:  
> > > On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:    
> > >> In case of the last page containing bitflips (ret > 0),
> > >> spinand_mtd_read() will return that number of bitflips for the last
> > >> page. But to me it looks like it should instead return max_bitflips like
> > >> it does when the last page read returns with 0.
> > >>
> > >> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>  
> 
> Please write your entire official first/last name(s)
> 
> > >> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
> > >> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>  
> 
> I am waiting your next version with Acked-by instead of Rewieved-by
> tags and Greg's comment addressed.

Sorry for the mistake, R-b tags are fine here, don't touch that.
The rest needs to be fixed though.

> > >> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")  
> 
> Finally, when we ask you to resend a patch, it means sending a new
> version of the patch. So in the subject, you should not use the
> [RESEND] keyword (which means you are sending something again exactly
> as it was before, you just got ignored, for example) but instead you
> should increment the version number (v3) and also write a nice
> changelog after the three dashes '---' (will be ignored by Git when
> applying).
> 
> I would like to queue this for the next release so if you can do it
> ASAP, that would be great.
> 
> Thank you,
> Miquèl




Thanks,
Miquèl
WeiXiong Liao June 28, 2019, 3:51 a.m. UTC | #7
Hi Miquel,

On 2019/6/28 AM2:17, Miquel Raynal wrote:
> Hi Miquel,
> 
> Miquel Raynal <miquel.raynal@bootlin.com> wrote on Thu, 27 Jun 2019
> 19:06:44 +0200:
> 
>> Hello,
>>
>> Schrempf Frieder <frieder.schrempf@kontron.de> wrote on Tue, 25 Jun
>> 2019 07:04:06 +0000:
>>
>>> Hi liaoweixiong,
>>>
>>> On 25.06.19 05:08, Greg KH wrote:  
>>>> On Tue, Jun 25, 2019 at 09:02:29AM +0800, liaoweixiong wrote:    
>>>>> In case of the last page containing bitflips (ret > 0),
>>>>> spinand_mtd_read() will return that number of bitflips for the last
>>>>> page. But to me it looks like it should instead return max_bitflips like
>>>>> it does when the last page read returns with 0.
>>>>>
>>>>> Signed-off-by: liaoweixiong <liaoweixiong@allwinnertech.com>  
>>
>> Please write your entire official first/last name(s)
>>

OK.

>>>>> Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
>>>>> Reviewed-by: Frieder Schrempf <frieder.schrempf@kontron.de>  
>>
>> I am waiting your next version with Acked-by instead of Rewieved-by
>> tags and Greg's comment addressed.
> 
> Sorry for the mistake, R-b tags are fine here, don't touch that.
> The rest needs to be fixed though.
> 

OK.

>>>>> Fixes: 7529df465248 ("mtd: nand: Add core infrastructure to support SPI NANDs")  
>>
>> Finally, when we ask you to resend a patch, it means sending a new
>> version of the patch. So in the subject, you should not use the
>> [RESEND] keyword (which means you are sending something again exactly
>> as it was before, you just got ignored, for example) but instead you
>> should increment the version number (v3) and also write a nice
>> changelog after the three dashes '---' (will be ignored by Git when
>> applying).
>>
>> I would like to queue this for the next release so if you can do it
>> ASAP, that would be great.
>>

I will do it right now.

>> Thank you,
>> Miquèl
> 
> 
> 
> 
> Thanks,
> Miquèl
>
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 556bfdb..6b9388d 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -511,12 +511,12 @@  static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
 		if (ret == -EBADMSG) {
 			ecc_failed = true;
 			mtd->ecc_stats.failed++;
-			ret = 0;
 		} else {
 			mtd->ecc_stats.corrected += ret;
 			max_bitflips = max_t(unsigned int, max_bitflips, ret);
 		}
 
+		ret = 0;
 		ops->retlen += iter.req.datalen;
 		ops->oobretlen += iter.req.ooblen;
 	}