Re: [PATCH] mm/page_alloc.c: Remove function return value

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

 



On 12/29/22 at 03:17pm, lvqian@xxxxxxxxxxxx wrote:
> From: lvqian <lvqian@xxxxxxxxxxxx>
> 
> The return value of this function has no meaning,
> so the original int type is replaced with a void type,
> which reduces the execution time of one return.
> 
> Signed-off-by: lvqian <lvqian@xxxxxxxxxxxx>
> ---
>  mm/page_alloc.c | 9 ++++-----
>  1 file changed, 4 insertions(+), 5 deletions(-)
> 
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0745aedebb37..fffe16d854a9 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -828,17 +828,16 @@ static int __init early_debug_pagealloc(char *buf)
>  }
>  early_param("debug_pagealloc", early_debug_pagealloc);
>  
> -static int __init debug_guardpage_minorder_setup(char *buf)
> +static void __init debug_guardpage_minorder_setup(char *buf)
>  {
>  	unsigned long res;
>  
>  	if (kstrtoul(buf, 10, &res) < 0 ||  res > MAX_ORDER / 2) {
>  		pr_err("Bad debug_guardpage_minorder value\n");
> -		return 0;

This could be not right. Please see parse_args(), the returned value is
needed, otherwise you might get stuff you don't want in the switch case
handling.

parse_early_param()
  -->parse_early_options()
     -->parse_args()

> +	} else {
> +		_debug_guardpage_minorder = res;
> +		pr_info("Setting debug_guardpage_minorder to %lu\n", res);
>  	}
> -	_debug_guardpage_minorder = res;
> -	pr_info("Setting debug_guardpage_minorder to %lu\n", res);
> -	return 0;
>  }
>  early_param("debug_guardpage_minorder", debug_guardpage_minorder_setup);
>  
> -- 
> 2.34.1
> 





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux