mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-09-21 07:01:57 +00:00
clk: scmi: fix scmi_clk_get_attibute()
Local variable out.name lives on the stack and therefore cannot
be returned directly. Move the strdup() call into the function.
(Coverity 352460)
Fixes: 7c33f78983
("clk: scmi: register scmi clocks with CCF")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
This commit is contained in:
parent
616571804a
commit
d657766819
1 changed files with 3 additions and 5 deletions
|
@ -53,7 +53,7 @@ static int scmi_clk_get_attibute(struct udevice *dev, int clkid, char **name)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
*name = out.clock_name;
|
||||
*name = strdup(out.clock_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -152,11 +152,9 @@ static int scmi_clk_probe(struct udevice *dev)
|
|||
return ret;
|
||||
|
||||
for (i = 0; i < num_clocks; i++) {
|
||||
char *name;
|
||||
|
||||
if (!scmi_clk_get_attibute(dev, i, &name)) {
|
||||
char *clock_name = strdup(name);
|
||||
char *clock_name;
|
||||
|
||||
if (!scmi_clk_get_attibute(dev, i, &clock_name)) {
|
||||
clk = kzalloc(sizeof(*clk), GFP_KERNEL);
|
||||
if (!clk || !clock_name)
|
||||
ret = -ENOMEM;
|
||||
|
|
Loading…
Reference in a new issue