Skip to contentSkip to conversation

mtd: Avoid magic values

PATCH Applied Miquel Raynal 2 participants 3 messages Mar 7, 2023 – Mar 22, 2023 Memory technology devices (MTD)

lore
Share & tools
lore

Miquel Raynal

author maintainer
#0 lore raw

PATCH 1/1 mtd: Avoid magic values

Nvmem producer config ID "-1" is actually defined, so use the definition rather than hardcoding it with a magic value.

---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mtd/mtdcore.c +1 -1
index e4e102585021..3f6fc45be1d2 100644
@@ -519,7 +519,7 @@ static int mtd_nvmem_add(struct mtd_info *mtd)
 	struct device_node *node = mtd_get_of_node(mtd);
 	struct nvmem_config config = {};
 
-	config.id = -1;
+	config.id = NVMEM_DEVID_NONE;
 	config.dev = &mtd->dev;
 	config.name = dev_name(&mtd->dev);
 	config.owner = THIS_MODULE;
Signature · 6 lines
2.34.1


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
Reviewed-by on v1 1/1
#1 lore raw

Am 2023-03-07 20:25, schrieb Miquel Raynal:

Quoted 5 lines

Nvmem producer config ID "-1" is actually defined, so use the definition rather than hardcoding it with a magic value.

-michael

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

author maintainer Applied
#2 lore raw
In reply to Miquel Raynal
Quoted 6 lines · Miquel Raynal

Nvmem producer config ID "-1" is actually defined, so use the definition rather than hardcoding it with a magic value.

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next.

Miquel

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/