From: alessioMaroni0 <alessiomaroni0@gmail.com>
To: ojeda@kernel.org
Cc: rust-for-linux@vger.kernel.org, boqun@kernel.org,
alessioMaroni0 <alessiomaroni0@gmail.com>
Subject: [PATCH] rust: error: use pr_warn_once! in from_errno
Date: Sat, 11 Jul 2026 23:09:19 +0200 [thread overview]
Message-ID: <20260711210919.33619-1-alessiomaroni0@gmail.com> (raw)
Replace crate::pr_warn! with crate::pr_warn_once! in Error::from_errno
to prevent logging noise if an invalid errno is repeatedly passed.
This resolves a pending TODO in the file.
Signed-off-by: alessioMaroni0 <alessiomaroni0@gmail.com>
---
rust/kernel/error.rs | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/rust/kernel/error.rs b/rust/kernel/error.rs
index a56ba6309..2d3e31aff 100644
--- a/rust/kernel/error.rs
+++ b/rust/kernel/error.rs
@@ -123,8 +123,7 @@ pub fn from_errno(errno: crate::ffi::c_int) -> Error {
if let Some(error) = Self::try_from_errno(errno) {
error
} else {
- // TODO: Make it a `WARN_ONCE` once available.
- crate::pr_warn!(
+ crate::pr_warn_once!(
"attempted to create `Error` with out of range `errno`: {}\n",
errno
);
--
2.55.0
next reply other threads:[~2026-07-11 21:09 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 21:09 alessioMaroni0 [this message]
2026-07-11 22:38 ` [PATCH] rust: error: use pr_warn_once! in from_errno FUJITA Tomonori
2026-07-11 22:40 ` Miguel Ojeda
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=20260711210919.33619-1-alessiomaroni0@gmail.com \
--to=alessiomaroni0@gmail.com \
--cc=boqun@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.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