[openwrt/openwrt] kernel: mtk_bmt: counteracting calloc-transposed-args compiler warning

LEDE Commits lede-commits at lists.infradead.org
Tue May 13 13:07:16 PDT 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/4d18c41a6c5da4ead0f5d69a630b935fb24434a0

commit 4d18c41a6c5da4ead0f5d69a630b935fb24434a0
Author: Mieczyslaw Nalewaj <namiltd at yahoo.com>
AuthorDate: Sun May 4 11:32:57 2025 +0200

    kernel: mtk_bmt: counteracting calloc-transposed-args compiler warning
    
    For kernel 6.12 there is a warning causing an error:
    drivers/mtd/nand/mtk_bmt_v2.c: In function 'mtk_bmt_get_mapping_mask':
    drivers/mtd/nand/mtk_bmt_v2.c:307:31: error: 'kmalloc_array_noprof' sizes specified with 'sizeof' in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
      307 |         used = kcalloc(sizeof(unsigned long), BIT_WORD(bmtd.bmt_blk_idx) + 1, GFP_KERNEL);
          |                               ^~~~~~~~
    
    Swapping the arguments solves the problem.
    
    Signed-off-by: Mieczyslaw Nalewaj <namiltd at yahoo.com>
    Link: https://github.com/openwrt/openwrt/pull/18701
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c
index 6b06948c0f..a17b729026 100644
--- a/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c
+++ b/target/linux/generic/files/drivers/mtd/nand/mtk_bmt_v2.c
@@ -304,7 +304,7 @@ mtk_bmt_get_mapping_mask(void)
 	unsigned long *used;
 	int i, k;
 
-	used = kcalloc(sizeof(unsigned long), BIT_WORD(bmtd.bmt_blk_idx) + 1, GFP_KERNEL);
+	used = kcalloc(BIT_WORD(bmtd.bmt_blk_idx) + 1, sizeof(unsigned long), GFP_KERNEL);
 	if (!used)
 		return NULL;
 




More information about the lede-commits mailing list