Re: [PATCH] staging: android: ion: Check for register_shrinker() failure.

2017-12-06 Thread Greg KH
On Wed, Nov 29, 2017 at 10:33:39PM +0900, Tetsuo Handa wrote:
> register_shrinker() might return -ENOMEM error since Linux 3.12.
> But since callers of ion_device_add_heap() are not ready to receive an
> error and it is not simple enough to fix within this patch, this patch
> just prints a warning line when register_shrinker() failed.
> 
> Signed-off-by: Tetsuo Handa 
> Cc: John Stultz 
> Cc: Greg Kroah-Hartman 
> Cc: Michal Hocko 
> ---
>  drivers/staging/android/ion/ion_heap.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ion/ion_heap.c 
> b/drivers/staging/android/ion/ion_heap.c
> index 91faa7f..56dcbd8 100644
> --- a/drivers/staging/android/ion/ion_heap.c
> +++ b/drivers/staging/android/ion/ion_heap.c
> @@ -312,5 +312,6 @@ void ion_heap_init_shrinker(struct ion_heap *heap)
>   heap->shrinker.scan_objects = ion_heap_shrink_scan;
>   heap->shrinker.seeks = DEFAULT_SEEKS;
>   heap->shrinker.batch = 0;
> - register_shrinker(>shrinker);
> + if (register_shrinker(>shrinker))
> + pr_err("Failed to create heap shrinker for %s\n", heap->name);

Shouldn't you fail the init function here?

Just reporting the issue isn't going to help anyone.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging: android: ion: Check for register_shrinker() failure.

2017-11-29 Thread Greg KH
On Wed, Nov 29, 2017 at 10:33:39PM +0900, Tetsuo Handa wrote:
> register_shrinker() might return -ENOMEM error since Linux 3.12.
> But since callers of ion_device_add_heap() are not ready to receive an
> error and it is not simple enough to fix within this patch, this patch
> just prints a warning line when register_shrinker() failed.
> 
> Signed-off-by: Tetsuo Handa 
> Cc: John Stultz 
> Cc: Greg Kroah-Hartman 

I think you need to update your address book, that old email hasn't been
valid for over 5 years now :)

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: Check for register_shrinker() failure.

2017-11-29 Thread Tetsuo Handa
register_shrinker() might return -ENOMEM error since Linux 3.12.
But since callers of ion_device_add_heap() are not ready to receive an
error and it is not simple enough to fix within this patch, this patch
just prints a warning line when register_shrinker() failed.

Signed-off-by: Tetsuo Handa 
Cc: John Stultz 
Cc: Greg Kroah-Hartman 
Cc: Michal Hocko 
---
 drivers/staging/android/ion/ion_heap.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/android/ion/ion_heap.c 
b/drivers/staging/android/ion/ion_heap.c
index 91faa7f..56dcbd8 100644
--- a/drivers/staging/android/ion/ion_heap.c
+++ b/drivers/staging/android/ion/ion_heap.c
@@ -312,5 +312,6 @@ void ion_heap_init_shrinker(struct ion_heap *heap)
heap->shrinker.scan_objects = ion_heap_shrink_scan;
heap->shrinker.seeks = DEFAULT_SEEKS;
heap->shrinker.batch = 0;
-   register_shrinker(>shrinker);
+   if (register_shrinker(>shrinker))
+   pr_err("Failed to create heap shrinker for %s\n", heap->name);
 }
-- 
1.8.3.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel