Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1417304
| From | Ingo Molnar <mingo@kernel.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems |
| Date | 2016-06-08 13:20 +0200 |
| Message-ID | <rHJGG-7U2-19@gated-at.bofh.it> (permalink) |
| References | <rFHSF-2re-5@gated-at.bofh.it> <rFHSF-2re-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
* Joseph Thelen <jthelen@sgi.com> wrote:
> static int __init setup_add_efi_memmap(char *arg)
> {
> + static bool arg_as_bool;
Why hidden inside local variables as static?
> + int ret = strtobool(arg, &arg_as_bool);
> +
> + /* check for a non-existent arg, to maintain backward compatibility */
> + if (!arg) {
> + add_efi_memmap = EFI_MEMMAP_ENABLED;
> + } else {
> + if (ret) {
> + /* a bad argument was passed... */
> + return ret;
> + } else {
> + if (arg_as_bool)
> + add_efi_memmap = EFI_MEMMAP_ENABLED;
> + else
> + add_efi_memmap = EFI_MEMMAP_DISABLED;
> + }
> + }
> +
> return 0;
And that's a really weird code flow!
How about something straightforward:
int val = 0;
int ret;
/* Check for a non-existent arg, to maintain backward compatibility: */
if (!arg) {
add_efi_memmap = EFI_MEMMAP_ENABLED;
return 0;
}
ret = strtobool(arg, &val);
/* Was a bad argument passed? */
if (ret)
return ret;
if (val)
add_efi_memmap = EFI_MEMMAP_ENABLED;
else
add_efi_memmap = EFI_MEMMAP_DISABLED;
return 0;
?
Also note the rename to 'val'.
Thanks,
Ingo
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems Joseph Thelen <jthelen@sgi.com> - 2016-06-02 23:00 +0200 Re: [PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems Ingo Molnar <mingo@kernel.org> - 2016-06-08 13:20 +0200 Re: [PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems Matt Fleming <matt@codeblueprint.co.uk> - 2016-06-08 14:40 +0200
csiph-web