From patchwork Sun Feb 27 18:10:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dr. David Alan Gilbert" X-Patchwork-Id: 12762065 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6123FC433F5 for ; Sun, 27 Feb 2022 18:11:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 819148D0002; Sun, 27 Feb 2022 13:11:08 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 7C9078D0001; Sun, 27 Feb 2022 13:11:08 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6B7FC8D0002; Sun, 27 Feb 2022 13:11:08 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0093.hostedemail.com [216.40.44.93]) by kanga.kvack.org (Postfix) with ESMTP id 595978D0001 for ; Sun, 27 Feb 2022 13:11:08 -0500 (EST) Received: from smtpin22.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 0CB3499EA6 for ; Sun, 27 Feb 2022 18:11:08 +0000 (UTC) X-FDA: 79189351416.22.E5C129D Received: from mx.treblig.org (mx.treblig.org [46.43.15.161]) by imf16.hostedemail.com (Postfix) with ESMTP id 63BB3180005 for ; Sun, 27 Feb 2022 18:11:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=treblig.org ; s=bytemarkmx; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=D6fceNIjKpwnS1biMuEu0ownwYQK1blsQ+uEVVtQEQo=; b=P0E4Nr4DmqSsmCEHU5jqJRzO5T wFVMmg3qXLKqDSiW5jEtJsG7ICRgDchzvZQr1M515LsQp3T7zajfHyexNCInWp+G0sv4g4iR9Egtq SNessDhV10bUUkr1eZlF2JPcqWs3/PE6HgqUeaP2/Dz7lLyuptyKDbpvKdA5sBCixDpCbR+bKh9yy zrBDho0XW9ntOcoYoY4yGxpIUexIiNCKXOH6RwezM7gq5k/vTYmcx0xUQZAUONkS0mzYQVLqCklaI 1Vswu/A5swVD3SDzXMo8mR01UBYr61DlsYG+gB2Olbe7FDkgEdcUXgPrKIb2W5QELoj761OIZTjD5 I/PW/yig==; Received: from localhost ([127.0.0.1] helo=dalek.home.treblig.org) by mx.treblig.org with esmtp (Exim 4.94.2) (envelope-from ) id 1nOO0f-0006o3-C9; Sun, 27 Feb 2022 18:11:04 +0000 From: "Dr. David Alan Gilbert" To: akpm@linux-foundation.org, pasha.tatashin@soleen.com, songmuchun@bytedance.com Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, "Dr. David Alan Gilbert" Subject: [PATCH] mm: Use strtobool for param parsing Date: Sun, 27 Feb 2022 18:10:39 +0000 Message-Id: <20220227181038.126926-1-linux@treblig.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: 63BB3180005 X-Rspam-User: Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=treblig.org header.s=bytemarkmx header.b=P0E4Nr4D; spf=pass (imf16.hostedemail.com: domain of linux@treblig.org designates 46.43.15.161 as permitted sender) smtp.mailfrom=linux@treblig.org; dmarc=none X-Stat-Signature: 7ugxyc1y1drp5aonqpoy7qddornx45o3 X-HE-Tag: 1645985467-562712 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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 --- 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); 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); } early_param("page_table_check", early_page_table_check_param);