tpm: get_buffer_size always succeeds

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2023-01-25 17:42:17 +00:00 committed by Rob Bradford
parent 2b76e1d7ba
commit 60425471dd
2 changed files with 4 additions and 4 deletions

View File

@ -259,7 +259,7 @@ impl Tpm {
}
fn reset(&mut self) -> Result<()> {
let cur_buff_size = self.emulator.get_buffer_size().unwrap();
let cur_buff_size = self.emulator.get_buffer_size();
self.regs = [0; TPM_CRB_R_MAX];
set_reg_field(
&mut self.regs,

View File

@ -454,12 +454,12 @@ impl Emulator {
Ok(())
}
pub fn get_buffer_size(&mut self) -> Result<usize> {
pub fn get_buffer_size(&mut self) -> usize {
let mut curr_buf_size: usize = 0;
match self.set_buffer_size(0, &mut curr_buf_size) {
Err(_) => Ok(TPM_CRB_BUFFER_MAX),
_ => Ok(curr_buf_size),
Err(_) => TPM_CRB_BUFFER_MAX,
_ => curr_buf_size,
}
}
}