[asahilinux:asahi-wip-7.2 645/964] warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`)
kernel test robot <[email protected]>
| Newsgroups | dev.linux.lists.oe-kbuild-all |
|---|---|
| Message-ID | <[email protected]> |
tree: https://github.com/AsahiLinux/linux asahi-wip-7.2 head: 57124f5176e4a4ceb553942a5f3de94cb5035877 commit: b43e4afc340b3afc32dbb781176c790a5897f163 [645/964] rust: dma_fence: Add DMA Fence abstraction config: x86_64-rhel-9.4-rust (https://download.01.org/0day-ci/archive/20260824/[email protected]/config) compiler: clang version 22.1.8 (https://github.com/llvm/llvm-project ca7933e47d3a3451d81e72ac174dcb5aa28b59d1) rustc: rustc 1.96.0 (ac68faa20 2026-05-25) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260824/[email protected]/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <[email protected]> | Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/ All warnings (new ones prefixed by >>): >> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`) --> rust/kernel/dma_fence.rs:173:22 | 173 | let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/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)]` help: try | 173 ~ let p = unsafe { { 174 + let offset: usize = ::core::mem::offset_of!($Container, $($fields)*); 175 + let field_ptr = $field_ptr; 176 + let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>(); 177 + $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut()); 178 + container_ptr 179 ~ } }; | -- >> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`) --> rust/kernel/dma_fence.rs:183:22 | 183 | let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast help: try | 183 ~ let p = unsafe { { 184 + let offset: usize = ::core::mem::offset_of!($Container, $($fields)*); 185 + let field_ptr = $field_ptr; 186 + let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>(); 187 + $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut()); 188 + container_ptr 189 ~ } }; | -- >> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`) --> rust/kernel/dma_fence.rs:191:22 | 191 | let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast help: try | 191 ~ let p = unsafe { { 192 + let offset: usize = ::core::mem::offset_of!($Container, $($fields)*); 193 + let field_ptr = $field_ptr; 194 + let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>(); 195 + $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut()); 196 + container_ptr 197 ~ } }; | -- >> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`) --> rust/kernel/dma_fence.rs:199:22 | 199 | let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast help: try | 199 ~ let p = unsafe { { 200 + let offset: usize = ::core::mem::offset_of!($Container, $($fields)*); 201 + let field_ptr = $field_ptr; 202 + let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>(); 203 + $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut()); 204 + container_ptr 205 ~ } }; | -- >> warning: associated items `as_ref` and `as_raw` are never used --> rust/kernel/dma_buf.rs:31:26 | 23 | impl DmaBuf { | ----------- associated items in this implementation ... 31 | pub(crate) unsafe fn as_ref<'a>(self_ptr: *mut bindings::dma_buf) -> &'a Self { | ^^^^^^ ... 36 | pub(crate) fn as_raw(&self) -> *mut bindings::dma_buf { | ^^^^^^ | = note: `#[warn(dead_code)]` (part of `#[warn(unused)]`) on by default -- >> warning: casting raw pointers to the same type and constness is unnecessary (`*mut dma_fence::FenceObject<T>` -> `*mut dma_fence::FenceObject<T>`) --> rust/kernel/dma_fence.rs:207:22 | 207 | let p = unsafe { crate::container_of!(fence, FenceObject<T>, fence) as *mut FenceObject<T> }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#unnecessary_cast help: try | 207 ~ let p = unsafe { { 208 + let offset: usize = ::core::mem::offset_of!($Container, $($fields)*); 209 + let field_ptr = $field_ptr; 210 + let container_ptr = field_ptr.byte_sub(offset).cast::<$Container>(); 211 + $crate::assert_same_type(field_ptr, (&raw const (*container_ptr).$($fields)*).cast_mut()); 212 + container_ptr 213 ~ } }; | -- >> warning: `as` casting between raw pointers while changing only its constness --> rust/kernel/dma_fence.rs:268:9 | 268 | &self.fence as *const _ as *mut _ | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: try `pointer::cast_mut`, a safer alternative: `(&self.fence as *const bindings::dma_fence).cast_mut()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#ptr_cast_constness = note: requested on the command line with `-W clippy::ptr-cast-constness` -- >> warning: casts from `u32` to `u64` can be expressed infallibly using `From` --> rust/kernel/dma_fence.rs:434:30 | 434 | self.start + context as u64, | ^^^^^^^^^^^^^^ | = help: an `as` cast can become silently lossy if the types change in the future = help: for further information visit https://rust-lang.github.io/rust-clippy/rust-1.96.0/index.html#cast_lossless = note: requested on the command line with `-W clippy::cast-lossless` help: use `u64::from` instead | 434 - self.start + context as u64, 434 + self.start + u64::from(context), | -- >> warning: method `into_raw` is never used --> rust/kernel/dma_fence.rs:467:19 | 451 | impl FenceChain { | --------------- method in this implementation ... 467 | pub(crate) fn into_raw(self) -> *mut bindings::dma_fence_chain { | ^^^^^^^^ -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki