lkml.org 
[lkml]   [2020]   [Nov]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] reboot: Fix variable assignments in type_store
On Wed, 11 Nov 2020 20:50:23 -0700 Nathan Chancellor <natechancellor@gmail.com> wrote:

> Clang warns:
>
> kernel/reboot.c:707:17: warning: implicit conversion from enumeration
> type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
> [-Wenum-conversion]
> reboot_mode = BOOT_TRIPLE;
> ~ ^~~~~~~~~~~
>
> ...
>
> --- a/kernel/reboot.c
> +++ b/kernel/reboot.c
> @@ -704,19 +704,19 @@ static ssize_t type_store(struct kobject *kobj, struct kobj_attribute *attr,
> return -EPERM;
>
> if (!strncmp(buf, BOOT_TRIPLE_STR, strlen(BOOT_TRIPLE_STR)))
> - reboot_mode = BOOT_TRIPLE;
> + reboot_type = BOOT_TRIPLE;
> else if (!strncmp(buf, BOOT_KBD_STR, strlen(BOOT_KBD_STR)))
> - reboot_mode = BOOT_KBD;
> + reboot_type = BOOT_KBD;
> else if (!strncmp(buf, BOOT_BIOS_STR, strlen(BOOT_BIOS_STR)))
> - reboot_mode = BOOT_BIOS;
> + reboot_type = BOOT_BIOS;
> else if (!strncmp(buf, BOOT_ACPI_STR, strlen(BOOT_ACPI_STR)))
> - reboot_mode = BOOT_ACPI;
> + reboot_type = BOOT_ACPI;
> else if (!strncmp(buf, BOOT_EFI_STR, strlen(BOOT_EFI_STR)))
> - reboot_mode = BOOT_EFI;
> + reboot_type = BOOT_EFI;
> else if (!strncmp(buf, BOOT_CF9_FORCE_STR, strlen(BOOT_CF9_FORCE_STR)))
> - reboot_mode = BOOT_CF9_FORCE;
> + reboot_type = BOOT_CF9_FORCE;
> else if (!strncmp(buf, BOOT_CF9_SAFE_STR, strlen(BOOT_CF9_SAFE_STR)))
> - reboot_mode = BOOT_CF9_SAFE;
> + reboot_type = BOOT_CF9_SAFE;
> else
> return -EINVAL;

This is a fairly dramatic change to the original patch, but it eyeballs
OK.

Matteo, could you please comment? And preferably retest?

\
 
 \ /
  Last update: 2020-11-13 00:14    [W:0.141 / U:1.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site