linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Dr. David Alan Gilbert" <linux@treblig.org>
Cc: pasha.tatashin@soleen.com, songmuchun@bytedance.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mm: Use strtobool for param parsing
Date: Sun, 27 Feb 2022 13:51:28 -0800	[thread overview]
Message-ID: <20220227135128.3f5aabca43c7a33acea91cc8@linux-foundation.org> (raw)
In-Reply-To: <20220227181038.126926-1-linux@treblig.org>

On Sun, 27 Feb 2022 18:10:39 +0000 "Dr. David Alan Gilbert" <linux@treblig.org> wrote:

> Use strtobool rather than open coding "on" and "off" parsing in
> mm/hugetlb_vmemmap.c and mm/page_table_check.c.
> 
> Signed-off-by: Dr. David Alan Gilbert <linux@treblig.org>
> ---
>  mm/hugetlb_vmemmap.c  | 12 +-----------
>  mm/page_table_check.c | 10 +---------
>  2 files changed, 2 insertions(+), 20 deletions(-)
> 
> diff --git a/mm/hugetlb_vmemmap.c b/mm/hugetlb_vmemmap.c
> index c540c21e26f5b..919411386e547 100644
> --- a/mm/hugetlb_vmemmap.c
> +++ b/mm/hugetlb_vmemmap.c
> @@ -192,17 +192,7 @@ static int __init early_hugetlb_free_vmemmap_param(char *buf)
>  		return 0;
>  	}
>  
> -	if (!buf)
> -		return -EINVAL;
> -
> -	if (!strcmp(buf, "on"))
> -		hugetlb_free_vmemmap_enabled = true;
> -	else if (!strcmp(buf, "off"))
> -		hugetlb_free_vmemmap_enabled = false;
> -	else
> -		return -EINVAL;
> -
> -	return 0;
> +	return strtobool(buf, &hugetlb_free_vmemmap_enabled);
>  }
>  early_param("hugetlb_free_vmemmap", early_hugetlb_free_vmemmap_param);

This part falls afoul of the changes in
https://lkml.kernel.org/r/20211101031651.75851-3-songmuchun@bytedance.com

> diff --git a/mm/page_table_check.c b/mm/page_table_check.c
> index 3763bd077861a..2458281bff893 100644
> --- a/mm/page_table_check.c
> +++ b/mm/page_table_check.c
> @@ -23,15 +23,7 @@ EXPORT_SYMBOL(page_table_check_disabled);
>  
>  static int __init early_page_table_check_param(char *buf)
>  {
> -	if (!buf)
> -		return -EINVAL;
> -
> -	if (strcmp(buf, "on") == 0)
> -		__page_table_check_enabled = true;
> -	else if (strcmp(buf, "off") == 0)
> -		__page_table_check_enabled = false;
> -
> -	return 0;
> +	return strtobool(buf, &__page_table_check_enabled);
>  }

But this works OK.


  reply	other threads:[~2022-02-27 21:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-27 18:10 Dr. David Alan Gilbert
2022-02-27 21:51 ` Andrew Morton [this message]
2022-02-28 12:18   ` Dr. David Alan Gilbert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220227135128.3f5aabca43c7a33acea91cc8@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@treblig.org \
    --cc=pasha.tatashin@soleen.com \
    --cc=songmuchun@bytedance.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox