]> sigrok.org Git - libsigrok.git/commitdiff
rdtech-dps: undo undesired register re-read logic change
authorGerhard Sittig <redacted>
Thu, 28 Sep 2023 10:37:51 +0000 (12:37 +0200)
committerGerhard Sittig <redacted>
Thu, 28 Sep 2023 11:43:50 +0000 (13:43 +0200)
Commit 02a4f485de76 snuck in a change that should not have gone there.
Revert the logic which re-reads Modbus registers several times before
declaring failure. Use the previous implementation as intended.

src/hardware/rdtech-dps/protocol.c

index d5e63bf8e32c60cb5d991cbcfd61ce3954e72dc8..49067818d43b5b10778cd2db687a05f80264cb42 100644 (file)
@@ -117,12 +117,12 @@ static int rdtech_dps_read_holding_registers(struct sr_modbus_dev_inst *modbus,
        int ret;
 
        retries = 3;
-       do {
+       while (retries--) {
                ret = sr_modbus_read_holding_registers(modbus,
                        address, nb_registers, registers);
                if (ret == SR_OK)
                        return ret;
-       } while (--retries);
+       }
 
        return ret;
 }