diff mbox series

mtd: nand: atmel: Fix get_sectorsize() function

Message ID 20180327170158.3351-1-boris.brezillon@bootlin.com
State Accepted
Delegated to: Boris Brezillon
Headers show
Series mtd: nand: atmel: Fix get_sectorsize() function | expand

Commit Message

Boris Brezillon March 27, 2018, 5:01 p.m. UTC
get_sectorsize() was not using the appropriate macro to extract the
ECC sector size from the config cache, which led to buggy ECC when
using 1024 byte sectors.

Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
Cc: <stable@vger.kernel.org>
Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
---
 drivers/mtd/nand/atmel/pmecc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Richard Weinberger March 27, 2018, 6:42 p.m. UTC | #1
Am Dienstag, 27. März 2018, 19:01:58 CEST schrieb Boris Brezillon:
> get_sectorsize() was not using the appropriate macro to extract the
> ECC sector size from the config cache, which led to buggy ECC when
> using 1024 byte sectors.
> 
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Cc: <stable@vger.kernel.org>
> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
> ---
>  drivers/mtd/nand/atmel/pmecc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
> index 8268636675ef..4124bf91bee6 100644
> --- a/drivers/mtd/nand/atmel/pmecc.c
> +++ b/drivers/mtd/nand/atmel/pmecc.c
> @@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user)
> 
>  static int get_sectorsize(struct atmel_pmecc_user *user)
>  {
> -	return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512;
> +	return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
>  }
> 
>  static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int
> sector)

Reviewed-by: Richard Weinberger <richard@nod.at>

Thanks,
//richard
Nicolas Ferre March 28, 2018, 8:17 a.m. UTC | #2
On 27/03/2018 at 19:01, Boris Brezillon wrote:
> get_sectorsize() was not using the appropriate macro to extract the
> ECC sector size from the config cache, which led to buggy ECC when
> using 1024 byte sectors.
> 
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Cc: <stable@vger.kernel.org>
> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
Thanks Boris.

Best regards,
   Nicolas

> ---
>   drivers/mtd/nand/atmel/pmecc.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
> index 8268636675ef..4124bf91bee6 100644
> --- a/drivers/mtd/nand/atmel/pmecc.c
> +++ b/drivers/mtd/nand/atmel/pmecc.c
> @@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user)
>   
>   static int get_sectorsize(struct atmel_pmecc_user *user)
>   {
> -	return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512;
> +	return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
>   }
>   
>   static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector)
>
Olivier Schonken March 28, 2018, 8:24 a.m. UTC | #3
On Wed, Mar 28, 2018 at 10:17 AM, Nicolas Ferre
<nicolas.ferre@microchip.com> wrote:
> On 27/03/2018 at 19:01, Boris Brezillon wrote:
>>
>> get_sectorsize() was not using the appropriate macro to extract the
>> ECC sector size from the config cache, which led to buggy ECC when
>> using 1024 byte sectors.
>>
>> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
>> Cc: <stable@vger.kernel.org>
>> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
>> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
>
>
> Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>
> Thanks Boris.
>
> Best regards,
>   Nicolas
>
>
>> ---
>>   drivers/mtd/nand/atmel/pmecc.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/mtd/nand/atmel/pmecc.c
>> b/drivers/mtd/nand/atmel/pmecc.c
>> index 8268636675ef..4124bf91bee6 100644
>> --- a/drivers/mtd/nand/atmel/pmecc.c
>> +++ b/drivers/mtd/nand/atmel/pmecc.c
>> @@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user)
>>     static int get_sectorsize(struct atmel_pmecc_user *user)
>>   {
>> -       return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 :
>> 512;
>> +       return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
>>   }
>>     static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user,
>> int sector)
>>
>
>
> --
> Nicolas Ferre

Tested-by: Olivier Schonken <olivier.schonken@gmail.com>
Thanks again.

Regards

Olivier
Boris Brezillon March 29, 2018, 5:22 p.m. UTC | #4
On Tue, 27 Mar 2018 19:01:58 +0200
Boris Brezillon <boris.brezillon@bootlin.com> wrote:

> get_sectorsize() was not using the appropriate macro to extract the
> ECC sector size from the config cache, which led to buggy ECC when
> using 1024 byte sectors.
> 
> Fixes: f88fc122cc34 ("mtd: nand: Cleanup/rework the atmel_nand driver")
> Cc: <stable@vger.kernel.org>
> Reported-by: Olivier Schonken <olivier.schonken@gmail.com>
> Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>

Applied.

> ---
>  drivers/mtd/nand/atmel/pmecc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
> index 8268636675ef..4124bf91bee6 100644
> --- a/drivers/mtd/nand/atmel/pmecc.c
> +++ b/drivers/mtd/nand/atmel/pmecc.c
> @@ -426,7 +426,7 @@ static int get_strength(struct atmel_pmecc_user *user)
>  
>  static int get_sectorsize(struct atmel_pmecc_user *user)
>  {
> -	return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512;
> +	return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
>  }
>  
>  static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector)
diff mbox series

Patch

diff --git a/drivers/mtd/nand/atmel/pmecc.c b/drivers/mtd/nand/atmel/pmecc.c
index 8268636675ef..4124bf91bee6 100644
--- a/drivers/mtd/nand/atmel/pmecc.c
+++ b/drivers/mtd/nand/atmel/pmecc.c
@@ -426,7 +426,7 @@  static int get_strength(struct atmel_pmecc_user *user)
 
 static int get_sectorsize(struct atmel_pmecc_user *user)
 {
-	return user->cache.cfg & PMECC_LOOKUP_TABLE_SIZE_1024 ? 1024 : 512;
+	return user->cache.cfg & PMECC_CFG_SECTOR1024 ? 1024 : 512;
 }
 
 static void atmel_pmecc_gen_syndrome(struct atmel_pmecc_user *user, int sector)