Skip to content

Commit

Permalink
libublk: ctr/lib: remove two unnecessary cast
Browse files Browse the repository at this point in the history
Signed-off-by: Ming Lei <tom.leiming@gmail.com>
  • Loading branch information
ming1 committed Oct 8, 2023
1 parent f40d2a5 commit de36c3f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ctrl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ fn ublk_ctrl_prep_cmd(
0
},
data: if (data.flags & CTRL_CMD_HAS_DATA) != 0 {
[data.data[0] as u64]
[data.data[0]]
} else {
[0]
},
Expand Down
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ pub const BDEV_PATH: &str = "/dev/ublkb";
pub fn ublk_alloc_buf(size: usize, align: usize) -> *mut u8 {
let layout = match Layout::from_size_align(size, align) {
Ok(r) => r,
Err(_) => return std::ptr::null_mut() as *mut u8,
Err(_) => return std::ptr::null_mut(),
};
unsafe { alloc(layout) as *mut u8 }
unsafe { alloc(layout) }
}

pub fn ublk_dealloc_buf(ptr: *mut u8, size: usize, align: usize) {
Expand Down

0 comments on commit de36c3f

Please sign in to comment.