From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: akpm@linux-foundation.org, hughd@google.com
Cc: david@redhat.com, baolin.wang@linux.alibaba.com,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH 3/6] mm: shmem: remove duplicate error validation
Date: Fri, 7 Feb 2025 17:44:19 +0800 [thread overview]
Message-ID: <dfadaba4c8b24c5ae1467fe8b6744b654c65ec91.1738918357.git.baolin.wang@linux.alibaba.com> (raw)
In-Reply-To: <cover.1738918357.git.baolin.wang@linux.alibaba.com>
Remove duplicate error code checks for 'start' and 'end', as the
get_order_from_str() will only return -EINVAL if the cmdline string
is configured incorrectly.
Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com>
---
mm/shmem.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/shmem.c b/mm/shmem.c
index b7aef4f0a427..b764ad336598 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5650,19 +5650,19 @@ static int __init setup_thp_shmem(char *str)
THP_ORDERS_ALL_FILE_DEFAULT);
}
- if (start == -EINVAL) {
+ if (start < 0) {
pr_err("invalid size %s in thp_shmem boot parameter\n",
start_size);
goto err;
}
- if (end == -EINVAL) {
+ if (end < 0) {
pr_err("invalid size %s in thp_shmem boot parameter\n",
end_size);
goto err;
}
- if (start < 0 || end < 0 || start > end)
+ if (start > end)
goto err;
nr = end - start + 1;
--
2.39.3
next prev parent reply other threads:[~2025-02-07 9:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-07 9:44 [PATCH 0/6] Some trivial cleanups for shmem Baolin Wang
2025-02-07 9:44 ` [PATCH 1/6] mm: shmem: drop the unused macro Baolin Wang
2025-02-07 9:44 ` [PATCH 2/6] mm: shmem: remove 'fadvise()' comments Baolin Wang
2025-02-07 9:44 ` Baolin Wang [this message]
2025-02-07 9:44 ` [PATCH 4/6] mm: shmem: change the return value of shmem_find_swap_entries() Baolin Wang
2025-02-07 9:44 ` [PATCH 5/6] mm: shmem: factor out the within_size logic into a new helper Baolin Wang
2025-02-07 9:44 ` [PATCH 6/6] MAINTAINERS: add myself as shmem reviewer Baolin Wang
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=dfadaba4c8b24c5ae1467fe8b6744b654c65ec91.1738918357.git.baolin.wang@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=hughd@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
/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