]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
PM: wakeup: Delete space in the end of string shown by pm_show_wakelocks()
authorZijun Hu <quic_zijuhu@quicinc.com>
Mon, 5 May 2025 09:26:51 +0000 (17:26 +0800)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Fri, 9 May 2025 13:48:39 +0000 (15:48 +0200)
pm_show_wakelocks() is called to generate a string when showing
attributes /sys/power/wake_(lock|unlock), but the string ends
with an unwanted space that was added back by mistake by commit
c9d967b2ce40 ("PM: wakeup: simplify the output logic of
pm_show_wakelocks()").

Remove the unwanted space.

Fixes: c9d967b2ce40 ("PM: wakeup: simplify the output logic of pm_show_wakelocks()")
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://patch.msgid.link/20250505-fix_power-v1-1-0f7f2c2f338c@quicinc.com
[ rjw: Changelog edits ]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
kernel/power/wakelock.c

index 52571dcad768b988eaadbd3ce98a4ac42dd2f7dd..4e941999a53ba69410f4526d5d55c32312c36140 100644 (file)
@@ -49,6 +49,9 @@ ssize_t pm_show_wakelocks(char *buf, bool show_active)
                        len += sysfs_emit_at(buf, len, "%s ", wl->name);
        }
 
+       if (len > 0)
+               --len;
+
        len += sysfs_emit_at(buf, len, "\n");
 
        mutex_unlock(&wakelocks_lock);