Skip to content

Commit 98ee748

Browse files
Darksonnbpf-ci[bot]
authored andcommitted
rust: device: avoid trailing ; in printing macros
commit a19bda8 upstream. These macros are used like expressions, so they should not emit a semicolon. This is being turned into a hard error in a future release of Rust. error: trailing semicolon in macro used in expression position --> drivers/gpu/nova-core/firmware/fsp.rs:79:34 | 79 | .inspect_err(|_| dev_err!(dev, "FMC firmware missing '{}' section\n", name)) | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! = note: for more information, see issue #79813 <rust-lang/rust#79813> = note: this error originates in the macro `dev_err` (in Nightly builds, run with -Z macro-backtrace for more info) [ I was doubly surprised since upstream made it a deny-by-default lint a year ago for Rust 1.91.0, and yet we didn't see it; plus I hadn't seen this in my CI even yesterday. It turns out this just landed into today's nightly (nightly-2026-07-16, using upstream commit d0babd8b6): Link: rust-lang/rust#159222 which says: "The `semicolon_in_expressions_from_macros` lint previously suppressed warnings about non-local macros. This masks a lint that will subsequently become a hard error." So that explains it. And this is the PR that will make it a hard error at some point in the future: Link: rust-lang/rust#159218 Thus starting with Rust 1.99.0 (expected 2026-10-01), we will be seeing the deny-by-default lint above, so clean it up already. - Miguel ] Cc: stable@vger.kernel.org # Needed in 6.18.y and later. Link: rust-lang/rust#79813 Signed-off-by: Alice Ryhl <aliceryhl@google.com> Reviewed-by: Gary Guo <gary@garyguo.net> Acked-by: Danilo Krummrich <dakr@kernel.org> Link: rust-lang/rust#159218 Link: rust-lang/rust#159222 Link: https://patch.msgid.link/20260716-device-trail-semicolon-v1-1-f48e9dcfae15@google.com [ Fixed typo. ] Signed-off-by: Miguel Ojeda <ojeda@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bcaba70 commit 98ee748

1 file changed

Lines changed: 9 additions & 11 deletions

File tree

rust/kernel/device.rs

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -737,9 +737,7 @@ macro_rules! impl_device_context_into_aref {
737737
#[macro_export]
738738
macro_rules! dev_printk {
739739
($method:ident, $dev:expr, $($f:tt)*) => {
740-
{
741-
$crate::device::Device::$method($dev.as_ref(), $crate::prelude::fmt!($($f)*))
742-
}
740+
$crate::device::Device::$method($dev.as_ref(), $crate::prelude::fmt!($($f)*))
743741
}
744742
}
745743

@@ -766,7 +764,7 @@ macro_rules! dev_printk {
766764
/// ```
767765
#[macro_export]
768766
macro_rules! dev_emerg {
769-
($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*); }
767+
($($f:tt)*) => { $crate::dev_printk!(pr_emerg, $($f)*) }
770768
}
771769

772770
/// Prints an alert-level message (level 1) prefixed with device information.
@@ -792,7 +790,7 @@ macro_rules! dev_emerg {
792790
/// ```
793791
#[macro_export]
794792
macro_rules! dev_alert {
795-
($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*); }
793+
($($f:tt)*) => { $crate::dev_printk!(pr_alert, $($f)*) }
796794
}
797795

798796
/// Prints a critical-level message (level 2) prefixed with device information.
@@ -818,7 +816,7 @@ macro_rules! dev_alert {
818816
/// ```
819817
#[macro_export]
820818
macro_rules! dev_crit {
821-
($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*); }
819+
($($f:tt)*) => { $crate::dev_printk!(pr_crit, $($f)*) }
822820
}
823821

824822
/// Prints an error-level message (level 3) prefixed with device information.
@@ -844,7 +842,7 @@ macro_rules! dev_crit {
844842
/// ```
845843
#[macro_export]
846844
macro_rules! dev_err {
847-
($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*); }
845+
($($f:tt)*) => { $crate::dev_printk!(pr_err, $($f)*) }
848846
}
849847

850848
/// Prints a warning-level message (level 4) prefixed with device information.
@@ -870,7 +868,7 @@ macro_rules! dev_err {
870868
/// ```
871869
#[macro_export]
872870
macro_rules! dev_warn {
873-
($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*); }
871+
($($f:tt)*) => { $crate::dev_printk!(pr_warn, $($f)*) }
874872
}
875873

876874
/// Prints a notice-level message (level 5) prefixed with device information.
@@ -896,7 +894,7 @@ macro_rules! dev_warn {
896894
/// ```
897895
#[macro_export]
898896
macro_rules! dev_notice {
899-
($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*); }
897+
($($f:tt)*) => { $crate::dev_printk!(pr_notice, $($f)*) }
900898
}
901899

902900
/// Prints an info-level message (level 6) prefixed with device information.
@@ -922,7 +920,7 @@ macro_rules! dev_notice {
922920
/// ```
923921
#[macro_export]
924922
macro_rules! dev_info {
925-
($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*); }
923+
($($f:tt)*) => { $crate::dev_printk!(pr_info, $($f)*) }
926924
}
927925

928926
/// Prints a debug-level message (level 7) prefixed with device information.
@@ -948,5 +946,5 @@ macro_rules! dev_info {
948946
/// ```
949947
#[macro_export]
950948
macro_rules! dev_dbg {
951-
($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*); }
949+
($($f:tt)*) => { $crate::dev_printk!(pr_dbg, $($f)*) }
952950
}

0 commit comments

Comments
 (0)