diff mbox series

mtd: Avoid magic values

Message ID 20230307192536.470997-1-miquel.raynal@bootlin.com
State Accepted
Headers show
Series mtd: Avoid magic values | expand

Commit Message

Miquel Raynal March 7, 2023, 7:25 p.m. UTC
Nvmem producer config ID "-1" is actually defined, so use the definition
rather than hardcoding it with a magic value.

Suggested-by: Michael Walle <michael@walle.cc>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
---
 drivers/mtd/mtdcore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Walle March 7, 2023, 8:31 p.m. UTC | #1
Am 2023-03-07 20:25, schrieb Miquel Raynal:
> Nvmem producer config ID "-1" is actually defined, so use the 
> definition
> rather than hardcoding it with a magic value.
> 
> Suggested-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>

Reviewed-by: Michael Walle <michael@walle.cc>

-michael
Miquel Raynal March 22, 2023, 4:08 p.m. UTC | #2
On Tue, 2023-03-07 at 19:25:36 UTC, Miquel Raynal wrote:
> Nvmem producer config ID "-1" is actually defined, so use the definition
> rather than hardcoding it with a magic value.
> 
> Suggested-by: Michael Walle <michael@walle.cc>
> Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
> Reviewed-by: Michael Walle <michael@walle.cc>

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

Miquel
diff mbox series

Patch

diff --git a/drivers/mtd/mtdcore.c b/drivers/mtd/mtdcore.c
index e4e102585021..3f6fc45be1d2 100644
--- a/drivers/mtd/mtdcore.c
+++ b/drivers/mtd/mtdcore.c
@@ -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;