Skip to content

Commit c6c9789

Browse files
committed
Fix warnings
1 parent e82958a commit c6c9789

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed

src/app/bios.rs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ use alloc::collections::BTreeMap;
22
use core::char;
33
use coreboot_fs::Rom;
44
use dmi;
5-
use ecflash::{Ec, EcFlash};
5+
use ecflash::EcFlash;
66
use intel_spi::{HsfStsCtl, Spi, SpiKbl, SpiCnl};
77
use plain::Plain;
88
use std::fs::{find, load};
99
use std::vars::{get_boot_item, get_boot_order, set_boot_item, set_boot_order};
1010
use uefi::status::{Error, Result};
1111

12-
use crate::key::raw_key;
13-
1412
use super::{FIRMWAREDIR, FIRMWARENSH, FIRMWAREROM, UEFIFLASH, shell, Component};
1513

1614
pub struct BiosComponent {
@@ -61,22 +59,22 @@ impl BiosComponent {
6159
}
6260
}
6361

64-
pub fn spi(&self) -> Option<(&'static mut Spi, HsfStsCtl)> {
62+
pub fn spi(&self) -> Option<(&'static mut dyn Spi, HsfStsCtl)> {
6563
match self.bios_vendor.as_str() {
6664
"coreboot" => match self.system_version.as_str() {
6765
"galp2" | "galp3" | "galp3-b" => {
6866
let spi_kbl = unsafe {
6967
&mut *(SpiKbl::address() as *mut SpiKbl)
7068
};
7169
let hsfsts_ctl = spi_kbl.hsfsts_ctl();
72-
Some((spi_kbl as &mut Spi, hsfsts_ctl))
70+
Some((spi_kbl as &mut dyn Spi, hsfsts_ctl))
7371
},
7472
"darp5" | "darp6" | "galp3-c" | "galp4" | "gaze14" | "lemp9" => {
7573
let spi_cnl = unsafe {
7674
&mut *(SpiCnl::address() as *mut SpiCnl)
7775
};
7876
let hsfsts_ctl = spi_cnl.hsfsts_ctl();
79-
Some((spi_cnl as &mut Spi, hsfsts_ctl))
77+
Some((spi_cnl as &mut dyn Spi, hsfsts_ctl))
8078
},
8179
_ => None,
8280
},
@@ -92,15 +90,15 @@ impl BiosComponent {
9290
println!("GetParam(WINF) = 0x{:>02X}", value);
9391
value |= 0x08;
9492
println!("SetParam(WINF, 0x{:>02X})", value);
95-
ec.set_param(0xDA, value);
93+
let _ = ec.set_param(0xDA, value);
9694

9795
println!("SetPOnTimer(0, 2)");
98-
ec.cmd(0x97);
99-
ec.write(0x00);
100-
ec.write(0x02);
96+
let _ = ec.cmd(0x97);
97+
let _ = ec.write(0x00);
98+
let _ = ec.write(0x02);
10199

102100
println!("PowerOff");
103-
ec.cmd(0x95);
101+
let _ = ec.cmd(0x95);
104102
}
105103

106104
println!("Halt");
@@ -130,7 +128,7 @@ impl Component for BiosComponent {
130128

131129
fn validate(&self) -> Result<bool> {
132130
let data = load(self.path())?;
133-
if let Some((spi, hsfsts_ctl)) = self.spi() {
131+
if let Some((spi, _hsfsts_ctl)) = self.spi() {
134132
// if hsfsts_ctl.contains(HsfStsCtl::FDOPSS) {
135133
// println!("SPI currently locked, attempting to unlock");
136134
// Self::spi_unlock();
@@ -149,7 +147,7 @@ impl Component for BiosComponent {
149147
}
150148

151149
fn flash(&self) -> Result<()> {
152-
if let Some((spi, hsfsts_ctl)) = self.spi() {
150+
if let Some((spi, _hsfsts_ctl)) = self.spi() {
153151
// Read new data
154152
let mut new;
155153
{

src/app/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ enum ValidateKind {
7272
Error(Error)
7373
}
7474

75-
fn components_validations() -> (Vec<Box<Component>>, Vec<ValidateKind>) {
76-
let components: Vec<Box<Component>> = vec![
75+
fn components_validations() -> (Vec<Box<dyn Component>>, Vec<ValidateKind>) {
76+
let components: Vec<Box<dyn Component>> = vec![
7777
Box::new(BiosComponent::new()),
7878
Box::new(EcComponent::new(true)),
7979
Box::new(EcComponent::new(false)),

0 commit comments

Comments
 (0)