rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] rust: simplify `Adapter::id_info`
@ 2025-06-25  4:36 Onur Özkan
  2025-06-25  8:22 ` Danilo Krummrich
  0 siblings, 1 reply; 8+ messages in thread
From: Onur Özkan @ 2025-06-25  4:36 UTC (permalink / raw)
  To: rust-for-linux, linux-kernel
  Cc: gregkh, rafael, dakr, ojeda, alex.gaynor, boqun.feng, gary,
	bjorn3_gh, lossin, a.hindborg, aliceryhl, tmgross,
	Onur Özkan

It was obviously unnecessary to check if `id` is `Some`.

Signed-off-by: Onur Özkan <work@onurozkan.dev>
---
 rust/kernel/driver.rs | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/rust/kernel/driver.rs b/rust/kernel/driver.rs
index ec9166cedfa7..1036755cb27d 100644
--- a/rust/kernel/driver.rs
+++ b/rust/kernel/driver.rs
@@ -178,11 +178,6 @@ fn of_id_info(_dev: &device::Device) -> Option<&'static Self::IdInfo> {
     /// If this returns `None`, it means that there is no match in any of the ID tables directly
     /// associated with a [`device::Device`].
     fn id_info(dev: &device::Device) -> Option<&'static Self::IdInfo> {
-        let id = Self::of_id_info(dev);
-        if id.is_some() {
-            return id;
-        }
-
-        None
+        Self::of_id_info(dev)
     }
 }
--
2.50.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-06-26  9:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-25  4:36 [PATCH] rust: simplify `Adapter::id_info` Onur Özkan
2025-06-25  8:22 ` Danilo Krummrich
2025-06-25  8:36   ` Onur
2025-06-25  8:39     ` Danilo Krummrich
2025-06-26  8:10       ` Onur
2025-06-26  9:41         ` Miguel Ojeda
2025-06-26  9:48           ` Danilo Krummrich
2025-06-26  9:59             ` Miguel Ojeda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).