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: 7c33f78983c3 ("clk: scmi: register scmi clocks with CCF")
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
diff --git a/drivers/clk/clk_scmi.c b/drivers/clk/clk_scmi.c
index 5702268..5aaabcf 100644
--- a/drivers/clk/clk_scmi.c
+++ b/drivers/clk/clk_scmi.c
@@ -53,7 +53,7 @@
 	if (ret)
 		return ret;
 
-	*name = out.clock_name;
+	*name = strdup(out.clock_name);
 
 	return 0;
 }
@@ -152,11 +152,9 @@
 		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;