[U-Boot] [PATCH 1/1] x86: don't compare pointers to 0
Bin Meng
bmeng.cn at gmail.com
Mon Nov 20 07:07:12 UTC 2017
Hi Heinrich,
On Sat, Nov 11, 2017 at 4:06 AM, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> x86_vendor_name is defined as
>
> static const char *const x86_vendor_name[]
>
> So its elements should not be compared to 0.
>
> Remove superfluous paranthesis.
>
> Problem identified with Coccinelle.
>
> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> ---
> arch/x86/cpu/cpu.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Bin Meng <bmeng.cn at gmail.com>
> diff --git a/arch/x86/cpu/cpu.c b/arch/x86/cpu/cpu.c
> index e13786efa5..a7f00ca49f 100644
> --- a/arch/x86/cpu/cpu.c
> +++ b/arch/x86/cpu/cpu.c
> @@ -143,8 +143,8 @@ const char *cpu_vendor_name(int vendor)
> {
> const char *name;
> name = "<invalid cpu vendor>";
> - if ((vendor < (ARRAY_SIZE(x86_vendor_name))) &&
> - (x86_vendor_name[vendor] != 0))
> + if (vendor < (ARRAY_SIZE(x86_vendor_name)) &&
nits: paranthesis around ARRAY_SIZE is superfluous here too.
> + x86_vendor_name[vendor])
> name = x86_vendor_name[vendor];
>
> return name;
> --
Regards,
Bin
More information about the U-Boot
mailing list