hc
2024-09-20 a36159eec6ca17402b0e146b86efaf76568dc353
kernel/arch/powerpc/platforms/powernv/opal-powercap.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * PowerNV OPAL Powercap interface
34 *
45 * Copyright 2017 IBM Corp.
5
- *
6
- * This program is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU General Public License
8
- * as published by the Free Software Foundation; either version
9
- * 2 of the License, or (at your option) any later version.
106 */
117
128 #define pr_fmt(fmt) "opal-powercap: " fmt
....@@ -17,7 +13,7 @@
1713
1814 #include <asm/opal.h>
1915
20
-DEFINE_MUTEX(powercap_mutex);
16
+static DEFINE_MUTEX(powercap_mutex);
2117
2218 static struct kobject *powercap_kobj;
2319
....@@ -199,7 +195,7 @@
199195 }
200196
201197 j = 0;
202
- pcaps[i].pg.name = node->name;
198
+ pcaps[i].pg.name = kasprintf(GFP_KERNEL, "%pOFn", node);
203199 if (has_min) {
204200 powercap_add_attr(min, "powercap-min",
205201 &pcaps[i].pattrs[j]);
....@@ -237,6 +233,7 @@
237233 while (--i >= 0) {
238234 kfree(pcaps[i].pattrs);
239235 kfree(pcaps[i].pg.attrs);
236
+ kfree(pcaps[i].pg.name);
240237 }
241238 kobject_put(powercap_kobj);
242239 out_pcaps: