File tree Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Expand file tree Collapse file tree 2 files changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -73,8 +73,8 @@ impl<const N: usize> ConstOfMatchTable<N> {
73
73
let compatible = compatible. as_bytes_with_nul ( ) ;
74
74
let mut i = 0 ;
75
75
while i < compatible. len ( ) {
76
- // if `compatible` does not fit in `id.compatible`, an
77
- // "index out of bounds" build time exception will be triggered.
76
+ // If `compatible` does not fit in `id.compatible`, an
77
+ // "index out of bounds" build time error will be triggered.
78
78
id. compatible [ i] = compatible[ i] as c_types:: c_char ;
79
79
i += 1 ;
80
80
}
@@ -90,6 +90,7 @@ impl<const N: usize> Deref for ConstOfMatchTable<N> {
90
90
// as per the `ConstOfMatchTable` type invariant, therefore
91
91
// `&OfMatchTable`'s inner reference will point to a sentinel-terminated C array.
92
92
let head = & self . table [ 0 ] as * const bindings:: of_device_id as * const OfMatchTable ;
93
+
93
94
// SAFETY: The returned reference must remain valid for the lifetime of `self`.
94
95
// The raw pointer `head` points to memory inside `self`. So the reference created
95
96
// from this raw pointer has the same lifetime as `self`.
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ impl Registration {
103
103
// - `module.0` lives at least as long as the module.
104
104
// - `probe()` and `remove()` are static functions.
105
105
// - `of_match_table` is either a raw pointer with static lifetime,
106
- // as guaranteed by the [`of::OfMatchTable::as_ptr()`] invariant ,
106
+ // as guaranteed by the [`of::OfMatchTable::as_ptr()`] return type ,
107
107
// or null.
108
108
let ret = unsafe { bindings:: __platform_driver_register ( & mut this. pdrv , module. 0 ) } ;
109
109
if ret < 0 {
You can’t perform that action at this time.
0 commit comments