From 2e566a6830b82d95837c4d669c63a0c1abf766a9 Mon Sep 17 00:00:00 2001 From: Harshit Mogalapalli Date: Thu, 24 Sep 2026 14:14:11 -0700 Subject: [PATCH] mtd: concat: use container_of_const() in CONCAT() CONCAT() currently recovers the enclosing struct mtd_concat by casting its embedded struct mtd_info pointer. This assumes mtd remains the first member of the structure. Use container_of_const() with the named member to make the relationship explicit and preserve any const qualifier. Suggested-by: Luca Ceresoli Signed-off-by: Harshit Mogalapalli Signed-off-by: Miquel Raynal --- drivers/mtd/mtdconcat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index c97167d51fe2..1585d31a507d 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c @@ -31,7 +31,7 @@ * Given a pointer to the MTD object in the mtd_concat structure, * we can retrieve the pointer to that structure with this macro. */ -#define CONCAT(x) ((struct mtd_concat *)(x)) +#define CONCAT(x) container_of_const(x, struct mtd_concat, mtd) /* * MTD methods which look up the relevant subdevice, translate the