All of lore.kernel.org
 help / color / mirror / Atom feed
From: marc.zyngier@arm.com (Marc Zyngier)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] irqchip: gicv3-its: fix use of max with decimal constant
Date: Wed, 17 Dec 2014 14:13:55 +0000	[thread overview]
Message-ID: <54918FA3.4090604@arm.com> (raw)
In-Reply-To: <1418825469-30529-1-git-send-email-will.deacon@arm.com>

Hi Will,

On 17/12/14 14:11, Will Deacon wrote:
> arm64 defconfig spits out the following compiler warning from the ITS
> driver:
> 
> In file included from include/linux/bitmap.h:9:0,
>                  from drivers/irqchip/irq-gic-v3-its.c:18:
> drivers/irqchip/irq-gic-v3-its.c: In function ?its_create_device?:
> include/linux/kernel.h:716:17: warning: comparison of distinct pointer types lacks a cast
>   (void) (&_max1 == &_max2);  \
>                  ^
> drivers/irqchip/irq-gic-v3-its.c:1056:12: note: in expansion of macro ?max?
>   nr_ites = max(2, roundup_pow_of_two(nvecs));
> 
> Fix the warning by specifying the decimal constant `2' explicitly as an
> unsigned long type.
> 
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> ---
>  drivers/irqchip/irq-gic-v3-its.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
> index 86e4684adeb1..d8996bdf0f61 100644
> --- a/drivers/irqchip/irq-gic-v3-its.c
> +++ b/drivers/irqchip/irq-gic-v3-its.c
> @@ -1053,7 +1053,7 @@ static struct its_device *its_create_device(struct its_node *its, u32 dev_id,
>  	 * of two entries. No, the architecture doesn't let you
>  	 * express an ITT with a single entry.
>  	 */
> -	nr_ites = max(2, roundup_pow_of_two(nvecs));
> +	nr_ites = max(2UL, roundup_pow_of_two(nvecs));
>  	sz = nr_ites * its->ite_size;
>  	sz = max(sz, ITS_ITT_ALIGN) + ITS_ITT_ALIGN - 1;
>  	itt = kmalloc(sz, GFP_KERNEL);
> 

Well spotted, thanks.

Acked-by: Marc Zyngier <marc.zyngier@arm.com>

	M.
-- 
Jazz is not dead. It just smells funny...

  reply	other threads:[~2014-12-17 14:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-17 14:11 [PATCH] irqchip: gicv3-its: fix use of max with decimal constant Will Deacon
2014-12-17 14:13 ` Marc Zyngier [this message]
2015-01-07  2:36 ` Jason Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54918FA3.4090604@arm.com \
    --to=marc.zyngier@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.