From: Chuhong Yuan Date: Fri, 9 Aug 2019 07:10:23 +0000 (+0800) Subject: PM: sleep: Replace strncmp() with str_has_prefix() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=d30bdfc0ecf885ca0495bdee522cb9d7ee005cf8;p=linux.git PM: sleep: Replace strncmp() with str_has_prefix() Use str_has_prefix() instead of strncmp() which is less straightforward in decode_state(). Signed-off-by: Chuhong Yuan [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki --- diff --git a/kernel/power/main.c b/kernel/power/main.c index 938dc53a8b945..e8710d179b35b 100644 --- a/kernel/power/main.c +++ b/kernel/power/main.c @@ -580,7 +580,7 @@ static suspend_state_t decode_state(const char *buf, size_t n) len = p ? p - buf : n; /* Check hibernation first. */ - if (len == 4 && !strncmp(buf, "disk", len)) + if (len == 4 && str_has_prefix(buf, "disk")) return PM_SUSPEND_MAX; #ifdef CONFIG_SUSPEND