Skip to content

Commit

Permalink
Examples: add some missing returns on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
marnovandermaas committed Nov 7, 2024
1 parent a1f5aa3 commit 61bce7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions examples/all/i2c_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ static void read_temperature_sensor_value(Mmio<OpenTitanI2c> i2c,
else
{
Debug::log("Could not read the {}", regName);
return;
}
}

Expand All @@ -52,6 +53,7 @@ static void id_eeprom_report(Mmio<OpenTitanI2c> i2c, const uint8_t IdAddr)
if (!i2c->blocking_read(IdAddr, data, sizeof(data)))
{
Debug::log("Failed to read EEPROM ID of device at address {}", IdAddr);
return;
}

Debug::log("EEPROM ID of device at address {}:", IdAddr);
Expand Down
1 change: 1 addition & 0 deletions examples/all/proximity_sensor_example.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ static void setup_proximity_sensor(Mmio<OpenTitanI2c> i2c, const uint8_t Addr)
if (!i2c->blocking_write(ApdS9960I2cAddress, buf, 2, true))
{
Debug::log("Failed to write proximity sensor address");
return;
}
}

Expand Down

0 comments on commit 61bce7c

Please sign in to comment.