Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

rust: miscdevice: fix warning on c_uint to u32 cast

When building miscdevice with clippy warnings, the following warning is
emitted:

warning: casting to the same type is unnecessary (`u32` -> `u32`)
--> /home/aliceryhl/rust-for-linux/rust/kernel/miscdevice.rs:220:28
|
220 | match T::ioctl(device, cmd as u32, arg as usize) {
| ^^^^^^^^^^ help: try: `cmd`
|
= help: for further information visit
https://rust-lang.github.io/rust-clippy/master/index.html#unnecessary_cast
= note: `-W clippy::unnecessary-cast` implied by `-W clippy::all`
= help: to override `-W clippy::all` add `#[allow(clippy::unnecessary_cast)]`

Thus, fix it.

Signed-off-by: Alice Ryhl <aliceryhl@google.com>
Link: https://lore.kernel.org/r/20241015-miscdevice-cint-cast-v1-1-fcf4b75700ac@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Alice Ryhl and committed by
Greg Kroah-Hartman
ccb22ca2 619325ca

+2 -2
+2 -2
rust/kernel/miscdevice.rs
··· 217 217 // SAFETY: Ioctl calls can borrow the private data of the file. 218 218 let device = unsafe { <T::Ptr as ForeignOwnable>::borrow(private) }; 219 219 220 - match T::ioctl(device, cmd as u32, arg as usize) { 220 + match T::ioctl(device, cmd, arg as usize) { 221 221 Ok(ret) => ret as c_long, 222 222 Err(err) => err.to_errno() as c_long, 223 223 } ··· 234 234 // SAFETY: Ioctl calls can borrow the private data of the file. 235 235 let device = unsafe { <T::Ptr as ForeignOwnable>::borrow(private) }; 236 236 237 - match T::compat_ioctl(device, cmd as u32, arg as usize) { 237 + match T::compat_ioctl(device, cmd, arg as usize) { 238 238 Ok(ret) => ret as c_long, 239 239 Err(err) => err.to_errno() as c_long, 240 240 }