summaryrefslogtreecommitdiff
path: root/drivers/misc
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2023-04-21 00:17:35 +0300
committerLinus Walleij <linus.walleij@linaro.org>2023-05-17 10:15:25 +0300
commit21e5a2d10c8f319be4126f320855429842473640 (patch)
treefc10aca8105ac1fbe1bc4e6de55492fd0bf28adc /drivers/misc
parent38bd22dac71ef7b1dbaa44fdc99f7722c116a01d (diff)
downloadlinux-21e5a2d10c8f319be4126f320855429842473640.tar.xz
misc: sram: Generate unique names for subpools
The current code will, if we do not specify unique labels for the SRAM subnodes, fail to register several nodes named the same. Example: sram@40020000 { (...) sram@0 { (...) }; sram@1000 { (...) }; }; Since the child->name in both cases will be "sram" the gen_pool_create() will fail because the name is not unique. Use dev_name() for the device as this will have bus ID set to the fully translated address for the node, and that will always be unique. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Link: https://lore.kernel.org/r/20230417-ux500-sram-v2-2-6e62ad551faa@linaro.org
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/sram.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/misc/sram.c b/drivers/misc/sram.c
index 99413310956b..5757adf418b1 100644
--- a/drivers/misc/sram.c
+++ b/drivers/misc/sram.c
@@ -235,10 +235,11 @@ static int sram_reserve_regions(struct sram_dev *sram, struct resource *res)
goto err_chunks;
}
if (!label)
- label = child->name;
-
- block->label = devm_kstrdup(sram->dev,
- label, GFP_KERNEL);
+ block->label = devm_kasprintf(sram->dev, GFP_KERNEL,
+ "%s", dev_name(sram->dev));
+ else
+ block->label = devm_kstrdup(sram->dev,
+ label, GFP_KERNEL);
if (!block->label) {
ret = -ENOMEM;
goto err_chunks;