Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 890dc73

Browse files
committedSep 26, 2020
Make match arms in irq_format_descriptor make more sense
1 parent 5791240 commit 890dc73

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed
 

‎aml/src/resource.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -299,11 +299,9 @@ pub struct IrqDescriptor {
299299

300300
fn irq_format_descriptor(bytes: &[u8]) -> Result<Resource, AmlError> {
301301

302-
// We do `- 1` here so the arms below match specification. It doesn't
303-
// count byte 0 for some reason.
304-
match bytes.len() - 1 {
305-
0..=1 => Err(AmlError::ResourceDescriptorTooShort),
306-
2 => {
302+
match bytes.len() {
303+
0..=2 => Err(AmlError::ResourceDescriptorTooShort),
304+
3 => { // 2 in spec
307305
let irq = LittleEndian::read_u16(&bytes[1..=2]);
308306

309307
Ok(Resource::Irq(IrqDescriptor {
@@ -316,7 +314,7 @@ fn irq_format_descriptor(bytes: &[u8]) -> Result<Resource, AmlError> {
316314
is_consumer: false // Is this correct?
317315
}))
318316
},
319-
3 => {
317+
4 => { // 3 in spec
320318
let irq = LittleEndian::read_u16(&bytes[1..=2]);
321319

322320
let information = bytes[3];

0 commit comments

Comments
 (0)
Please sign in to comment.