Skip to contentSkip to conversation

staging: android: ion: fixes spars warning cast to restricted gfp_t

PATCH In review Bijosh Thykkoottathil 2 participants 2 messages Dec 21, 2015 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: android: ion: fixes spars warning cast to restricted gfp_t

From: Bijosh Thykkoottathil <[email protected]>

This patch fixes following sparse warnings:

drivers/staging/android/ion/ion.c:1475:21: warning: incorrect type in assignment (different base types)
drivers/staging/android/ion/ion.c:1475:21: expected restricted gfp_t [usertype] gfp_mask
drivers/staging/android/ion/ion.c:1475:21: got int
drivers/staging/android/ion/ion.c:1493:21: warning: incorrect type in assignment (different base types)
drivers/staging/android/ion/ion.c:1493:21: expected restricted gfp_t [usertype] gfp_mask
drivers/staging/android/ion/ion.c:1493:21: got int

---
 drivers/staging/android/ion/ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion.c +2 -2
index e237e9f..f986a58 100644
@@ -1472,7 +1472,7 @@ static int debug_shrink_set(void *data, u64 val)
 	struct shrink_control sc;
 	int objs;
 
-	sc.gfp_mask = -1;
+	sc.gfp_mask = (__force gfp_t)(-1);
 	sc.nr_to_scan = val;
 
 	if (!val) {
@@ -1490,7 +1490,7 @@ static int debug_shrink_get(void *data, u64 *val)
 	struct shrink_control sc;
 	int objs;
 
-	sc.gfp_mask = -1;
+	sc.gfp_mask = (__force gfp_t)(-1);
 	sc.nr_to_scan = 0;
 
 	objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
Signature · 1 line
2.5.0
#1 lore raw
Quoted 21 lines · Bijosh Thykkoottathil

From: Bijosh Thykkoottathil <[email protected]>

This patch fixes following sparse warnings:

drivers/staging/android/ion/ion.c:1475:21: warning: incorrect type in assignment (different base types)
drivers/staging/android/ion/ion.c:1475:21: expected restricted gfp_t [usertype] gfp_mask
drivers/staging/android/ion/ion.c:1475:21: got int
drivers/staging/android/ion/ion.c:1493:21: warning: incorrect type in assignment (different base types)
drivers/staging/android/ion/ion.c:1493:21: expected restricted gfp_t [usertype] gfp_mask
drivers/staging/android/ion/ion.c:1493:21: got int

---
  drivers/staging/android/ion/ion.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/android/ion/ion.c +0 -0
index e237e9f..f986a58 100644

drivers/staging/android/ion/ion.c static int debug_shrink_set(void *data, u64 val) · line 1476

Quoted 6 lines
drivers/staging/android/ion/ion.c +1 -1
@@ -1472,7 +1472,7 @@ static int debug_shrink_set(void *data, u64 val)
  	struct shrink_control sc;
  	int objs;
 
-	sc.gfp_mask = -1;
+	sc.gfp_mask = (__force gfp_t)(-1);
  	sc.nr_to_scan = val;

-1 doesn't actually make much sense here. I'd rather see this changed to be an appropriate GFP flag rather than just casting it away, probably GFP_HIGHUSER. If you'd like to fix this up, make sure to double check that the shrinking behavior remains the same (similar number of low and high pages are reclaimed).

Thanks,
Laura