Skip to content

Commit 7440107

Browse files
authored
Merge pull request #152 from wedsonaf/result
Remove the remaining instances of `KernelResult<()>`.
2 parents 56df8a7 + e62f318 commit 7440107

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

rust/kernel/user_ptr.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl UserSlicePtr {
126126
/// mapped, writable memory (in which case some data from before the
127127
/// fault may be written), or `data` is larger than the user slice
128128
/// (in which case no data is written).
129-
pub fn write_all(self, data: &[u8]) -> KernelResult<()> {
129+
pub fn write_all(self, data: &[u8]) -> KernelResult {
130130
self.writer().write_slice(data)
131131
}
132132

@@ -180,7 +180,7 @@ impl UserSlicePtrReader {
180180
/// Returns `EFAULT` if the byte slice is bigger than the remaining size
181181
/// of the user slice or if the address does not currently point to mapped,
182182
/// readable memory.
183-
pub fn read_slice(&mut self, data: &mut [u8]) -> KernelResult<()> {
183+
pub fn read_slice(&mut self, data: &mut [u8]) -> KernelResult {
184184
// SAFETY: The output buffer is valid as it's coming from a live reference.
185185
unsafe { self.read_raw(data.as_mut_ptr(), data.len()) }
186186
}
@@ -190,7 +190,7 @@ impl UserSlicePtrReader {
190190
/// # Safety
191191
///
192192
/// The output buffer must be valid.
193-
pub unsafe fn read_raw(&mut self, out: *mut u8, len: usize) -> KernelResult<()> {
193+
pub unsafe fn read_raw(&mut self, out: *mut u8, len: usize) -> KernelResult {
194194
if len > self.1 || len > u32::MAX as usize {
195195
return Err(error::Error::EFAULT);
196196
}
@@ -239,7 +239,7 @@ impl UserSlicePtrWriter {
239239
/// Returns `EFAULT` if the byte slice is bigger than the remaining size
240240
/// of the user slice or if the address does not currently point to mapped,
241241
/// writable memory.
242-
pub fn write_slice(&mut self, data: &[u8]) -> KernelResult<()> {
242+
pub fn write_slice(&mut self, data: &[u8]) -> KernelResult {
243243
// SAFETY: The input buffer is valid as it's coming from a live reference.
244244
unsafe { self.write_raw(data.as_ptr(), data.len()) }
245245
}
@@ -249,7 +249,7 @@ impl UserSlicePtrWriter {
249249
/// # Safety
250250
///
251251
/// The input buffer must be valid.
252-
unsafe fn write_raw(&mut self, data: *const u8, len: usize) -> KernelResult<()> {
252+
unsafe fn write_raw(&mut self, data: *const u8, len: usize) -> KernelResult {
253253
if len > self.1 || len > u32::MAX as usize {
254254
return Err(error::Error::EFAULT);
255255
}

0 commit comments

Comments
 (0)