Skip to content

Commit d30bdfc

Browse files
WillLesterrafaeljw
authored andcommitted
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 <hslester96@gmail.com> [ rjw: Subject & changelog ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 2c8db5b commit d30bdfc

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎kernel/power/main.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ static suspend_state_t decode_state(const char *buf, size_t n)
580580
len = p ? p - buf : n;
581581

582582
/* Check hibernation first. */
583-
if (len == 4 && !strncmp(buf, "disk", len))
583+
if (len == 4 && str_has_prefix(buf, "disk"))
584584
return PM_SUSPEND_MAX;
585585

586586
#ifdef CONFIG_SUSPEND

0 commit comments

Comments
 (0)