summaryrefslogtreecommitdiffstats
path: root/drivers/powercap/powercap_sys.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/powercap/powercap_sys.c')
-rw-r--r--drivers/powercap/powercap_sys.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/powercap/powercap_sys.c b/drivers/powercap/powercap_sys.c
index 3f0b8e2ef3d4..f0654a932b37 100644
--- a/drivers/powercap/powercap_sys.c
+++ b/drivers/powercap/powercap_sys.c
@@ -170,9 +170,8 @@ static ssize_t show_constraint_name(struct device *dev,
if (pconst && pconst->ops && pconst->ops->get_name) {
name = pconst->ops->get_name(power_zone, id);
if (name) {
- snprintf(buf, POWERCAP_CONSTRAINT_NAME_LEN,
- "%s\n", name);
- buf[POWERCAP_CONSTRAINT_NAME_LEN] = '\0';
+ sprintf(buf, "%.*s\n", POWERCAP_CONSTRAINT_NAME_LEN - 1,
+ name);
len = strlen(buf);
}
}