From: FUJITA Tomonori <tomo@flapping.org>
To: alessiomaroni0@gmail.com
Cc: ojeda@kernel.org, rust-for-linux@vger.kernel.org, boqun@kernel.org
Subject: Re: [PATCH] rust: error: use pr_warn_once! in from_errno
Date: Sun, 12 Jul 2026 07:38:49 +0900 (JST) [thread overview]
Message-ID: <20260712.073849.1464463190973607209.tomo@flapping.org> (raw)
In-Reply-To: <20260711210919.33619-1-alessiomaroni0@gmail.com>
On Sat, 11 Jul 2026 23:09:19 +0200
alessioMaroni0 <alessiomaroni0@gmail.com> wrote:
> 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
WARN_ONCE and pr_warn_once are not the same thing.
WARN_ONCE prints a full stack trace and register dump.
pr_warn_once is just sorta of printk.
I'll add warn_once macro after the patch to add bug macro [1] is
merged.
[1] https://lore.kernel.org/rust-for-linux/20260709000103.2912159-1-tomo@aliasing.net/
next prev parent reply other threads:[~2026-07-11 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-11 21:09 [PATCH] rust: error: use pr_warn_once! in from_errno alessioMaroni0
2026-07-11 22:38 ` FUJITA Tomonori [this message]
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=20260712.073849.1464463190973607209.tomo@flapping.org \
--to=tomo@flapping.org \
--cc=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