Skip to content
  • Nathan Chancellor's avatar
    reboot: fix variable assignments in type_store · 7c9c06c3
    Nathan Chancellor authored
    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;
                                ~ ^~~~~~~~~~~
    kernel/reboot.c:709:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_KBD;
                                ~ ^~~~~~~~
    kernel/reboot.c:711:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_BIOS;
                                ~ ^~~~~~~~~
    kernel/reboot.c:713:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_ACPI;
                                ~ ^~~~~~~~~
    kernel/reboot.c:715:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_EFI;
                                ~ ^~~~~~~~
    kernel/reboot.c:717:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_CF9_FORCE;
                                ~ ^~~~~~~~~~~~~~
    kernel/reboot.c:719:17: warning: implicit conversion from enumeration
    type 'enum reboot_type' to different enumeration type 'enum reboot_mode'
    [-Wenum-conversion]
                    reboot_mode = BOOT_CF9_SAFE;
                                ~ ^~~~~~~~~~~~~
    7 warnings generated.
    
    It seems that these assignment should be to reboot_type, not
    reboot_mode. Fix it so there are no more warnings and the code works
    properly.
    
    Link: https://lkml.kernel.org/r/20201112035023.974748-1-natechancellor@gmail.com
    Fixes: eab8da48579d ("reboot: allow to specify reboot mode via sysfs")
    Link: https://github.com/ClangBuiltLinux/linux/issues/1197
    
    
    Signed-off-by: default avatarNathan Chancellor <natechancellor@gmail.com>
    Reviewed-by: default avatarMatteo Croce <mcroce@microsoft.com>
    Tested-by: default avatarMatteo Croce <mcroce@microsoft.com>
    Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
    Cc: Arnd Bergmann <arnd@arndb.de>
    Cc: Guenter Roeck <linux@roeck-us.net>
    Cc: Kees Cook <keescook@chromium.org>
    Cc: Mike Rapoport <rppt@kernel.org>
    Cc: Pavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Tyler Hicks <tyhicks@linux.microsoft.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
    7c9c06c3