From: Gerhard Sittig Date: Thu, 28 Sep 2023 10:37:51 +0000 (+0200) Subject: rdtech-dps: undo undesired register re-read logic change X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=f0f6b926c296a0a6e5fca1aba51cec77521c2f4c;p=libsigrok.git rdtech-dps: undo undesired register re-read logic change 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. --- diff --git a/src/hardware/rdtech-dps/protocol.c b/src/hardware/rdtech-dps/protocol.c index d5e63bf8..49067818 100644 --- a/src/hardware/rdtech-dps/protocol.c +++ b/src/hardware/rdtech-dps/protocol.c @@ -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; }