2023-07-09 02:31:26

by xuanzhenggang001

[permalink] [raw]
Subject: [PATCH] efi: x86: prefer 'unsigned int' to bare use of 'unsigned'

This patch fixes the following checkpatch warning:
arch/x86/platform/efi/efi_64.c:109: WARNING: Prefer 'unsigned int' to
bare use of 'unsigned'
arch/x86/platform/efi/efi_64.c:177: WARNING: Prefer 'unsigned int' to
bare use of 'unsigned'
arch/x86/platform/efi/efi_64.c:182: WARNING: Prefer 'unsigned int' to
bare use of 'unsigned'

Signed-off-by: Zhenggang Xuan <[email protected]>
---
arch/x86/platform/efi/efi_64.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/platform/efi/efi_64.c
b/arch/x86/platform/efi/efi_64.c
index 232acf418cfb..0f69bd6eb144 100644
--- a/arch/x86/platform/efi/efi_64.c
+++ b/arch/x86/platform/efi/efi_64.c
@@ -106,7 +106,7 @@ int __init efi_alloc_page_tables(void)
*/
void efi_sync_low_kernel_mappings(void)
{
- unsigned num_entries;
+ unsigned int num_entries;
pgd_t *pgd_k, *pgd_efi;
p4d_t *p4d_k, *p4d_efi;
pud_t *pud_k, *pud_efi;
@@ -174,12 +174,12 @@ virt_to_phys_or_null_size(void *va, unsigned long
size)
#define virt_to_phys_or_null(addr) \
virt_to_phys_or_null_size((addr), sizeof(*(addr)))

-int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned
num_pages)
+int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned int
num_pages)
{
extern const u8 __efi64_thunk_ret_tramp[];
unsigned long pfn, text, pf, rodata, tramp;
struct page *page;
- unsigned npages;
+ unsigned int npages;
pgd_t *pgd = efi_mm.pgd;

/*


2023-07-09 18:30:56

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH] efi: x86: prefer 'unsigned int' to bare use of 'unsigned'

On Sun, Jul 9, 2023 at 5:20 AM <[email protected]> wrote:
>
> This patch fixes the following checkpatch warning:
> arch/x86/platform/efi/efi_64.c:109: WARNING: Prefer 'unsigned int' to
> bare use of 'unsigned'
> arch/x86/platform/efi/efi_64.c:177: WARNING: Prefer 'unsigned int' to
> bare use of 'unsigned'
> arch/x86/platform/efi/efi_64.c:182: WARNING: Prefer 'unsigned int' to
> bare use of 'unsigned'

> -int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned
> num_pages)
> +int __init efi_setup_page_tables(unsigned long pa_memmap, unsigned int
> num_pages)

Nice, but you shouldn't just blindly do some mechanic "fixes". Now
your patch makes differences between the function prototype and its
implementation.

--
With Best Regards,
Andy Shevchenko