* [PATCH] irqchip: gicv3-its: fix use of max with decimal constant
@ 2014-12-17 14:11 Will Deacon
2014-12-17 14:13 ` Marc Zyngier
2015-01-07 2:36 ` Jason Cooper
0 siblings, 2 replies; 3+ messages in thread
From: Will Deacon @ 2014-12-17 14:11 UTC (permalink / raw)
To: linux-arm-kernel
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);
--
2.1.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH] irqchip: gicv3-its: fix use of max with decimal constant
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
2015-01-07 2:36 ` Jason Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Marc Zyngier @ 2014-12-17 14:13 UTC (permalink / raw)
To: linux-arm-kernel
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...
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] irqchip: gicv3-its: fix use of max with decimal constant
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
@ 2015-01-07 2:36 ` Jason Cooper
1 sibling, 0 replies; 3+ messages in thread
From: Jason Cooper @ 2015-01-07 2:36 UTC (permalink / raw)
To: linux-arm-kernel
On Wed, Dec 17, 2014 at 02:11:09PM +0000, 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(-)
Applied to irqchip/urgent with Marc's Ack.
thx,
Jason.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-07 2:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2015-01-07 2:36 ` Jason Cooper
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).