Skip to content

Commit b84900e

Browse files
committed
Put unsafe operations in an unsafe
1 parent 7264cba commit b84900e

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/mac/frame_filtering/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,14 @@ impl FrameFiltering {
183183
.bits(addr.address.high())
184184
});
185185

186-
eth_mac.$regl.write(|w| w.$al().bits(addr.address.low()));
186+
// This operation is only unsafe for register maca2lr STM32F107
187+
//
188+
// NOTE(safety): this operation is only unsafe for a single one
189+
// of the lower-address-part registers, so this should be fine.
190+
#[allow(unused_unsafe)]
191+
eth_mac
192+
.$regl
193+
.write(|w| unsafe { w.$al().bits(addr.address.low()) });
187194
}
188195
};
189196
}

src/tx.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,6 @@ impl<'a> TxRing<'a> {
222222
// Register TxDescriptor
223223
eth_dma
224224
.dmatdlar
225-
// Note: unsafe block required for `stm32f107`.
226225
.write(|w| unsafe { w.stl().bits(ring_ptr as u32) });
227226

228227
// "Preceding reads and writes cannot be moved past subsequent writes."

0 commit comments

Comments
 (0)