Skip to content

Commit 0559333

Browse files
authored
Merge pull request #389 from TheSven73/rust-for-linux-nits
rust/kernel/of: apply additional documentation suggestions
2 parents e428010 + 78d2b09 commit 0559333

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

rust/kernel/of.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ impl<const N: usize> ConstOfMatchTable<N> {
7373
let compatible = compatible.as_bytes_with_nul();
7474
let mut i = 0;
7575
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.
7878
id.compatible[i] = compatible[i] as c_types::c_char;
7979
i += 1;
8080
}
@@ -90,6 +90,7 @@ impl<const N: usize> Deref for ConstOfMatchTable<N> {
9090
// as per the `ConstOfMatchTable` type invariant, therefore
9191
// `&OfMatchTable`'s inner reference will point to a sentinel-terminated C array.
9292
let head = &self.table[0] as *const bindings::of_device_id as *const OfMatchTable;
93+
9394
// SAFETY: The returned reference must remain valid for the lifetime of `self`.
9495
// The raw pointer `head` points to memory inside `self`. So the reference created
9596
// from this raw pointer has the same lifetime as `self`.

rust/kernel/platdev.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ impl Registration {
103103
// - `module.0` lives at least as long as the module.
104104
// - `probe()` and `remove()` are static functions.
105105
// - `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,
107107
// or null.
108108
let ret = unsafe { bindings::__platform_driver_register(&mut this.pdrv, module.0) };
109109
if ret < 0 {

0 commit comments

Comments
 (0)