Re: [PATCH] fix sparse warning from include/linux/mmzone.h
From: Harvey Harrison
Date: Fri Feb 08 2008 - 17:45:39 EST
include/linux/mmzone.h:640:22: warning: potentially expensive pointer subtraction
Signed-off-by: Harvey Harrison <harvey.harrison@xxxxxxxxx>
---
Linus, something like the following?
include/linux/mmzone.h | 7 ++++---
1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index 8d8d197..7ed2922 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -637,9 +637,10 @@ static inline int is_normal_idx(enum zone_type idx)
static inline int is_highmem(struct zone *zone)
{
#ifdef CONFIG_HIGHMEM
- int zone_idx = zone - zone->zone_pgdat->node_zones;
- return zone_idx == ZONE_HIGHMEM ||
- (zone_idx == ZONE_MOVABLE && zone_movable_is_highmem());
+ struct zone *base = zone->zone_pgdat->node_zones;
+
+ return zone == base + ZONE_HIGHMEM ||
+ (zone == base + ZONE_MOVABLE && zone_movable_is_highmem());
#else
return 0;
#endif
--
1.5.4.1219.g65b9
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/