diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-08 16:37:44 +0100 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2015-02-09 22:56:24 +0100 |
commit | 97ec21675cf345ceb55f223ee724e5812f4fcfc3 (patch) | |
tree | a8c1679fa83784d35ce742002b5bf5a14e1fe116 /src/drivers/hmc5883 | |
parent | bd90700f59f3de83e9865df3fdb70ed162a48028 (diff) | |
download | px4-firmware-97ec21675cf345ceb55f223ee724e5812f4fcfc3.tar.gz px4-firmware-97ec21675cf345ceb55f223ee724e5812f4fcfc3.tar.bz2 px4-firmware-97ec21675cf345ceb55f223ee724e5812f4fcfc3.zip |
HMC driver: Return value handling
Diffstat (limited to 'src/drivers/hmc5883')
-rw-r--r-- | src/drivers/hmc5883/hmc5883.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/drivers/hmc5883/hmc5883.cpp b/src/drivers/hmc5883/hmc5883.cpp index 3515ff4a1..c4d8e37f1 100644 --- a/src/drivers/hmc5883/hmc5883.cpp +++ b/src/drivers/hmc5883/hmc5883.cpp @@ -1355,10 +1355,9 @@ start_bus(struct hmc5883_bus_option &bus, enum Rotation rotation) void start(enum HMC5883_BUS busid, enum Rotation rotation) { - uint8_t i; bool started = false; - for (i=0; i<NUM_BUS_OPTIONS; i++) { + for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) { if (busid == HMC5883_BUS_ALL && bus_options[i].dev != NULL) { // this device is already started continue; @@ -1373,7 +1372,6 @@ start(enum HMC5883_BUS busid, enum Rotation rotation) if (!started) errx(1, "driver start failed"); - // one or more drivers started OK exit(0); } @@ -1382,13 +1380,13 @@ start(enum HMC5883_BUS busid, enum Rotation rotation) */ struct hmc5883_bus_option &find_bus(enum HMC5883_BUS busid) { - for (uint8_t i=0; i<NUM_BUS_OPTIONS; i++) { + for (unsigned i = 0; i < NUM_BUS_OPTIONS; i++) { if ((busid == HMC5883_BUS_ALL || busid == bus_options[i].busid) && bus_options[i].dev != NULL) { return bus_options[i]; } } - errx(1,"bus %u not started", (unsigned)busid); + errx(1, "bus %u not started", (unsigned)busid); } @@ -1625,6 +1623,8 @@ hmc5883_main(int argc, char *argv[]) } else { errx(1, "calibration failed"); } + } else { + exit(0); } } |