[PATCH 3/3] PM: wakelock: fix spacing and improve readability

Mohit Joshi
2026-04-17T14:10:15Z

---
kernel/power/wakelock.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/power/wakelock.c b/kernel/power/wakelock.c
index fd763da06a87..9f576809b5f5 100644
--- a/kernel/power/wakelock.c
+++ b/kernel/power/wakelock.c
@@ -214,13 +214,15 @@ int pm_wake_lock(const char *buf)
if (!capable(CAP_BLOCK_SUSPEND))
return -EPERM;

+ /* Extract wakelock name (until space or end) */
while (*str && !isspace(*str))
- str++;
+ str++;

len = str - buf;
if (!len)
return -EINVAL;

+ /* Check for optional timeout value */
if (*str && *str != '\n') {
/* Find out if there's a valid timeout string appended. */
ret = kstrtou64(skip_spaces(str), 10, &timeout_ns);
@@ -245,7 +247,6 @@ int pm_wake_lock(const char *buf)
}

wakelocks_lru_most_recent(wl);
-
out:
mutex_unlock(&wakelocks_lock);
return ret;
@@ -264,7 +265,7 @@ int pm_wake_unlock(const char *buf)
if (!len)
return -EINVAL;

- if (buf[len-1] == '\n')
+ if (buf[len - 1] == '\n')
len--;

if (!len)
--
2.43.0