hmc5883: fixed driver startup when trying both buses

This commit is contained in:
Andrew Tridgell
2014-07-06 22:37:40 +10:00
committed by Lorenz Meier
parent 5e62ae7a9e
commit dfee93f3b1
+2 -2
View File
@@ -1325,11 +1325,11 @@ start(enum Rotation rotation)
exit(0);
fail:
if (g_dev_int != nullptr) {
if (g_dev_int != nullptr && (bus == -1 || bus == PX4_I2C_BUS_ONBOARD)) {
delete g_dev_int;
g_dev_int = nullptr;
}
if (g_dev_ext != nullptr) {
if (g_dev_ext != nullptr && (bus == -1 || bus == PX4_I2C_BUS_EXPANSION)) {
delete g_dev_ext;
g_dev_ext = nullptr;
}