linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] staging: android: ion: fixes spars warning cast to restricted gfp_t
@ 2015-12-21 11:24 Bijosh Thykkoottathil
  2015-12-21 20:16 ` Laura Abbott
  0 siblings, 1 reply; 2+ messages in thread
From: Bijosh Thykkoottathil @ 2015-12-21 11:24 UTC (permalink / raw)
  To: gregkh, arve, riandrews
  Cc: labbott, mitchelh, sumit.semwal, linux-kernel, Bijosh Thykkoottathil

From: Bijosh Thykkoottathil <bijosh.thyks@gmail.com>

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

Signed-off-by: Bijosh Thykkoottathil <bijosh.thyks@gmail.com>
---
 drivers/staging/android/ion/ion.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index e237e9f..f986a58 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -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);
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 1/1] staging: android: ion: fixes spars warning cast to restricted gfp_t
  2015-12-21 11:24 [PATCH 1/1] staging: android: ion: fixes spars warning cast to restricted gfp_t Bijosh Thykkoottathil
@ 2015-12-21 20:16 ` Laura Abbott
  0 siblings, 0 replies; 2+ messages in thread
From: Laura Abbott @ 2015-12-21 20:16 UTC (permalink / raw)
  To: Bijosh Thykkoottathil, gregkh, arve, riandrews
  Cc: mitchelh, sumit.semwal, linux-kernel

On 12/21/2015 03:24 AM, Bijosh Thykkoottathil wrote:
> From: Bijosh Thykkoottathil <bijosh.thyks@gmail.com>
>
> 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
>
> Signed-off-by: Bijosh Thykkoottathil <bijosh.thyks@gmail.com>
> ---
>   drivers/staging/android/ion/ion.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
> index e237e9f..f986a58 100644
> --- a/drivers/staging/android/ion/ion.c
> +++ b/drivers/staging/android/ion/ion.c
> @@ -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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-12-21 20:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-21 11:24 [PATCH 1/1] staging: android: ion: fixes spars warning cast to restricted gfp_t Bijosh Thykkoottathil
2015-12-21 20:16 ` Laura Abbott

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).