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

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

 



On Wed, Nov 29, 2017 at 10:32:00PM +0900, Tetsuo Handa wrote:
> register_shrinker() might return -ENOMEM error since Linux 3.12.
> 
> Signed-off-by: Tetsuo Handa <penguin-kernel@xxxxxxxxxxxxxxxxxxx>
> Cc: Robert Love <rlove@xxxxxxxxx>
> Cc: Marco Nelissen <marcone@xxxxxxxxxxx>
> Cc: John Stultz <john.stultz@xxxxxxxxxx>
> Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxx>
> ---
>  drivers/staging/android/ashmem.c | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/staging/android/ashmem.c b/drivers/staging/android/ashmem.c
> index 0f695df..ab56f81 100644
> --- a/drivers/staging/android/ashmem.c
> +++ b/drivers/staging/android/ashmem.c
> @@ -862,12 +862,18 @@ static int __init ashmem_init(void)
>  		goto out_free2;
>  	}
>  
> -	register_shrinker(&ashmem_shrinker);
> +	ret = register_shrinker(&ashmem_shrinker);
> +	if (unlikely(ret)) {

Never use unlikely/likely unless you can benchmark the speed change.

Hint, in init functions you never need this...

Please fix up and resend.

thanks,

greg k-h
_______________________________________________
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