Re: [PATCH 1/1] staging: ion: debugfs sparse warning, proper mask

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 02/20/2016 07:15 PM, Derek Yerger wrote:
 From drivers/staging/android TODO file - sparse errors.

The current code attempts assignment of -1 to unsigned type gfp_t.
Assignment should be an enumerated type of GFP_KERNEL, GFP_ATOMIC,
GFP_HIGHMEM, or __GFP_HIGH.

The original 2014 patch by Gioh Kim adding debugfs support to android/ion
used __GFP_HIGHMEM as the mask, but was removed in a subsequent revert.
This patch removes the sparse errors, and fixes the assignment as noted
above.

Please add commit references for the patches you are referring to.
At least in the upstream staging tree the GFP mask has been -1 since it was
initially added (ea313b5f8 "gpu: ion: Also shrink memory cached in the deferred
free list") and I can't find the commits from Gioh Kim you are referring to.

Signed-off-by: Derek Yerger <dy@xxxxxxxxxx>
---
diff --git a/drivers/staging/android/ion/ion.c b/drivers/staging/android/ion/ion.c
index c97e82b..a9ca46f 100644
--- a/drivers/staging/android/ion/ion.c
+++ b/drivers/staging/android/ion/ion.c
@@ -1524,7 +1524,7 @@ static int debug_shrink_set(void *data, u64 val)
      struct shrink_control sc;
      int objs;

-    sc.gfp_mask = -1;
+    sc.gfp_mask = __GFP_HIGHMEM;
      sc.nr_to_scan = val;

Using just __GFP_HIGHMEM is a bit weird for a GFP mask. I'd rather see this
be something like GFP_HIGHUSER to represent what an actual allocation might
be or add a comment explaining why just __GFP_HIGHMEM is okay.

Thanks,
Laura


      if (!val) {
@@ -1542,7 +1542,7 @@ static int debug_shrink_get(void *data, u64 *val)
      struct shrink_control sc;
      int objs;

-    sc.gfp_mask = -1;
+    sc.gfp_mask = __GFP_HIGHMEM;
      sc.nr_to_scan = 0;

      objs = heap->shrinker.count_objects(&heap->shrinker, &sc);
_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel



[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux