* [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
@ 2020-06-24 13:26 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-06-24 13:26 UTC (permalink / raw)
To: Paul Cercueil
Cc: Vignesh Raghavendra, Richard Weinberger, kernel-janitors,
linux-kernel, Harvey Hunt, linux-mtd, Miquel Raynal
The ARRAY_SIZE() is the number of elements but we want to use sizeof()
here for the number of bytes. Fortunately, they are the same thing
because it's an array of u8 so this has no effect on runtime.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mtd/nand/raw/ingenic/jz4740_ecc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
index 13fea645c7f0..54e377754a6c 100644
--- a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
+++ b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
@@ -90,8 +90,8 @@ static int jz4740_ecc_calculate(struct ingenic_ecc *ecc,
* If the written data is completely 0xff, we also want to write 0xff as
* ECC, otherwise we will get in trouble when doing subpage writes.
*/
- if (memcmp(ecc_code, empty_block_ecc, ARRAY_SIZE(empty_block_ecc)) = 0)
- memset(ecc_code, 0xff, ARRAY_SIZE(empty_block_ecc));
+ if (memcmp(ecc_code, empty_block_ecc, sizeof(empty_block_ecc)) = 0)
+ memset(ecc_code, 0xff, sizeof(empty_block_ecc));
return 0;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
@ 2020-06-24 13:26 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-06-24 13:26 UTC (permalink / raw)
To: Paul Cercueil
Cc: Vignesh Raghavendra, Richard Weinberger, kernel-janitors,
linux-kernel, Harvey Hunt, linux-mtd, Miquel Raynal
The ARRAY_SIZE() is the number of elements but we want to use sizeof()
here for the number of bytes. Fortunately, they are the same thing
because it's an array of u8 so this has no effect on runtime.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mtd/nand/raw/ingenic/jz4740_ecc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
index 13fea645c7f0..54e377754a6c 100644
--- a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
+++ b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
@@ -90,8 +90,8 @@ static int jz4740_ecc_calculate(struct ingenic_ecc *ecc,
* If the written data is completely 0xff, we also want to write 0xff as
* ECC, otherwise we will get in trouble when doing subpage writes.
*/
- if (memcmp(ecc_code, empty_block_ecc, ARRAY_SIZE(empty_block_ecc)) == 0)
- memset(ecc_code, 0xff, ARRAY_SIZE(empty_block_ecc));
+ if (memcmp(ecc_code, empty_block_ecc, sizeof(empty_block_ecc)) == 0)
+ memset(ecc_code, 0xff, sizeof(empty_block_ecc));
return 0;
}
--
2.27.0
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
@ 2020-06-24 13:26 ` Dan Carpenter
0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2020-06-24 13:26 UTC (permalink / raw)
To: Paul Cercueil
Cc: Harvey Hunt, Miquel Raynal, Richard Weinberger,
Vignesh Raghavendra, linux-mtd, linux-kernel, kernel-janitors
The ARRAY_SIZE() is the number of elements but we want to use sizeof()
here for the number of bytes. Fortunately, they are the same thing
because it's an array of u8 so this has no effect on runtime.
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
drivers/mtd/nand/raw/ingenic/jz4740_ecc.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
index 13fea645c7f0..54e377754a6c 100644
--- a/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
+++ b/drivers/mtd/nand/raw/ingenic/jz4740_ecc.c
@@ -90,8 +90,8 @@ static int jz4740_ecc_calculate(struct ingenic_ecc *ecc,
* If the written data is completely 0xff, we also want to write 0xff as
* ECC, otherwise we will get in trouble when doing subpage writes.
*/
- if (memcmp(ecc_code, empty_block_ecc, ARRAY_SIZE(empty_block_ecc)) == 0)
- memset(ecc_code, 0xff, ARRAY_SIZE(empty_block_ecc));
+ if (memcmp(ecc_code, empty_block_ecc, sizeof(empty_block_ecc)) == 0)
+ memset(ecc_code, 0xff, sizeof(empty_block_ecc));
return 0;
}
--
2.27.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
2020-06-24 13:26 ` Dan Carpenter
(?)
@ 2020-07-07 18:56 ` Miquel Raynal
-1 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2020-07-07 18:56 UTC (permalink / raw)
To: Dan Carpenter, Paul Cercueil
Cc: Vignesh Raghavendra, Richard Weinberger, kernel-janitors,
linux-kernel, Harvey Hunt, linux-mtd, Miquel Raynal
On Wed, 2020-06-24 at 13:26:40 UTC, Dan Carpenter wrote:
> The ARRAY_SIZE() is the number of elements but we want to use sizeof()
> here for the number of bytes. Fortunately, they are the same thing
> because it's an array of u8 so this has no effect on runtime.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
@ 2020-07-07 18:56 ` Miquel Raynal
0 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2020-07-07 18:56 UTC (permalink / raw)
To: Dan Carpenter, Paul Cercueil
Cc: Vignesh Raghavendra, Richard Weinberger, kernel-janitors,
linux-kernel, Harvey Hunt, linux-mtd, Miquel Raynal
On Wed, 2020-06-24 at 13:26:40 UTC, Dan Carpenter wrote:
> The ARRAY_SIZE() is the number of elements but we want to use sizeof()
> here for the number of bytes. Fortunately, they are the same thing
> because it's an array of u8 so this has no effect on runtime.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use
@ 2020-07-07 18:56 ` Miquel Raynal
0 siblings, 0 replies; 6+ messages in thread
From: Miquel Raynal @ 2020-07-07 18:56 UTC (permalink / raw)
To: Dan Carpenter, Paul Cercueil
Cc: Miquel Raynal, Vignesh Raghavendra, Richard Weinberger,
kernel-janitors, linux-kernel, Harvey Hunt, linux-mtd
On Wed, 2020-06-24 at 13:26:40 UTC, Dan Carpenter wrote:
> The ARRAY_SIZE() is the number of elements but we want to use sizeof()
> here for the number of bytes. Fortunately, they are the same thing
> because it's an array of u8 so this has no effect on runtime.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git nand/next, thanks.
Miquel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-07-07 18:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-24 13:26 [PATCH] mtd: rawnand: ingenic: cleanup ARRAY_SIZE() vs sizeof() use Dan Carpenter
2020-06-24 13:26 ` Dan Carpenter
2020-06-24 13:26 ` Dan Carpenter
2020-07-07 18:56 ` Miquel Raynal
2020-07-07 18:56 ` Miquel Raynal
2020-07-07 18:56 ` Miquel Raynal
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.