From afe162ceca79c3ec32c5701f682812dc5c18d0aa Mon Sep 17 00:00:00 2001 From: Stephan Maka Date: Fri, 16 Aug 2019 01:13:35 +0200 Subject: [PATCH] firmware: don't unwrap() but propagate pca9548 errors --- artiq/firmware/libboard_artiq/pca9548.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/artiq/firmware/libboard_artiq/pca9548.rs b/artiq/firmware/libboard_artiq/pca9548.rs index 684620d0e..a69d72ed7 100644 --- a/artiq/firmware/libboard_artiq/pca9548.rs +++ b/artiq/firmware/libboard_artiq/pca9548.rs @@ -2,10 +2,10 @@ use i2c; pub fn select(busno: u8, address: u8, channels: u8) -> Result<(), &'static str> { i2c::start(busno).unwrap(); - if !i2c::write(busno, address << 1).unwrap() { + if !i2c::write(busno, address << 1)? { return Err("PCA9548 failed to ack write address") } - if !i2c::write(busno, channels).unwrap() { + if !i2c::write(busno, channels)? { return Err("PCA9548 failed to ack control word") } i2c::stop(busno).unwrap();