lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250429150346.392050-1-ojeda@kernel.org>
Date: Tue, 29 Apr 2025 17:03:46 +0200
From: Miguel Ojeda <ojeda@...nel.org>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	"Rafael J. Wysocki" <rafael@...nel.org>,
	Danilo Krummrich <dakr@...nel.org>,
	Miguel Ojeda <ojeda@...nel.org>,
	Alex Gaynor <alex.gaynor@...il.com>
Cc: Boqun Feng <boqun.feng@...il.com>,
	Gary Guo <gary@...yguo.net>,
	Björn Roy Baron <bjorn3_gh@...tonmail.com>,
	Benno Lossin <benno.lossin@...ton.me>,
	Andreas Hindborg <a.hindborg@...nel.org>,
	Alice Ryhl <aliceryhl@...gle.com>,
	Trevor Gross <tmgross@...ch.edu>,
	rust-for-linux@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	patches@...ts.linux.dev
Subject: [PATCH] rust: device: allow `dead_code` for `Device<>::parent()`

When `CONFIG_AUXILIARY_BUS` is disabled, `parent()` is still dead code:

    error: method `parent` is never used
      --> rust/kernel/device.rs:71:19
       |
    64 | impl<Ctx: DeviceContext> Device<Ctx> {
       | ------------------------------------ method in this implementation
    ...
    71 |     pub(crate) fn parent(&self) -> Option<&Self> {
       |                   ^^^^^^
       |
       = note: `-D dead-code` implied by `-D warnings`
       = help: to override `-D warnings` add `#[allow(dead_code)]`

Thus reintroduce the `expect`, but now as an `allow`, and do so as
`dead_code` since that is narrower.

Fixes: ce735e73dd59 ("rust: auxiliary: add auxiliary device / driver abstractions")
Signed-off-by: Miguel Ojeda <ojeda@...nel.org>
---
I should have noticed this earlier, sorry. Please feel free to rebase to
fix it directly there if you prefer.

 rust/kernel/device.rs | 1 +
 1 file changed, 1 insertion(+)

diff --git a/rust/kernel/device.rs b/rust/kernel/device.rs
index 40c1f549b0ba..e8ab4b9617db 100644
--- a/rust/kernel/device.rs
+++ b/rust/kernel/device.rs
@@ -68,6 +68,7 @@ pub(crate) fn as_raw(&self) -> *mut bindings::device {
     }

     /// Returns a reference to the parent device, if any.
+    #[allow(dead_code)]
     pub(crate) fn parent(&self) -> Option<&Self> {
         // SAFETY:
         // - By the type invariant `self.as_raw()` is always valid.

base-commit: ce735e73dd59b169b877cedd0753297c81c2a091
--
2.49.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ