Later commits will change struct device_node::name to have a type of const char *, leading to a warning here. A nicer fix would be to use strdup_const here, but this needs some more work, so for now duplicate the string. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- arch/sandbox/board/hostfile.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/sandbox/board/hostfile.c b/arch/sandbox/board/hostfile.c index 7afad95b6d8b..9122ff9da2f1 100644 --- a/arch/sandbox/board/hostfile.c +++ b/arch/sandbox/board/hostfile.c @@ -156,7 +156,7 @@ static int hf_probe(struct device *dev) cdev_set_of_node(cdev, np); if (is_blockdev) { - cdev->name = np->name; + cdev->name = strdup(np->name); priv->blk.dev = dev; priv->blk.ops = &hf_blk_ops; priv->blk.blockbits = SECTOR_SHIFT; @@ -169,7 +169,7 @@ static int hf_probe(struct device *dev) dev_info(dev, "registered as block device\n"); } else { - cdev->name = np->name; + cdev->name = strdup(np->name); cdev->dev = dev; cdev->ops = &hf_cdev_ops; cdev->size = reg[1]; -- 2.39.5