From 7b1409c279bf001832e51b4b978632f316f8f32c Mon Sep 17 00:00:00 2001 From: Michael Heimpold Date: Tue, 19 Jun 2018 22:09:55 +0200 Subject: [PATCH] Remove redundant register count check We have the same check already in exported functions modbus_read_registers and modbus_read_input_registers which both calls out to the internal static function read_registers. So we can safely remove this redundant check in read_registers. Signed-off-by: Michael Heimpold --- src/modbus.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/modbus.c b/src/modbus.c index e3737bb2..e7997f2b 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -1335,17 +1335,6 @@ static int read_registers(modbus_t *ctx, int function, int addr, int nb, uint16_ uint8_t req[_MIN_REQ_LENGTH]; uint8_t rsp[MAX_MESSAGE_LENGTH]; - if (nb > MODBUS_MAX_READ_REGISTERS) { - if (ctx->debug) { - fprintf(stderr, - "ERROR Too many registers requested (%d > %d)\n", - nb, - MODBUS_MAX_READ_REGISTERS); - } - errno = EMBMDATA; - return -1; - } - req_length = ctx->backend->build_request_basis(ctx, function, addr, nb, req); rc = send_msg(ctx, req, req_length);