提交 ed5df085 编写于 作者: B Bin Meng 提交者: Tom Rini

nand: atmel: Initialize pmecc smu with correct size

Currently in pmecc_get_sigma(), the code tries to clear the memory
pointed by smu with wrong size 'sizeof(int16_t) * ARRAY_SIZE(smu)'.
Since smu is actually a pointer, not an array, so ARRAY_SIZE(smu)
does not generate correct size to be cleared.

In fact, GCC 8.1.0 reports a warning against it:

error: division 'sizeof (int16_t * {aka short int *}) / sizeof (int16_t
{aka short int})' does not compute the number of array elements
[-Werror=sizeof-pointer-div]

Fix it by using the correct size.
Signed-off-by: NBin Meng <bmeng.cn@gmail.com>
Reviewed-by: NMiquel Raynal <miquel.raynal@bootlin.com>
上级 7702713e
...@@ -249,7 +249,7 @@ static void pmecc_get_sigma(struct mtd_info *mtd) ...@@ -249,7 +249,7 @@ static void pmecc_get_sigma(struct mtd_info *mtd)
int diff; int diff;
/* Init the Sigma(x) */ /* Init the Sigma(x) */
memset(smu, 0, sizeof(int16_t) * ARRAY_SIZE(smu)); memset(smu, 0, sizeof(int16_t) * num * (cap + 2));
dmu_0_count = 0; dmu_0_count = 0;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册