diff --git a/src/modbus.c b/src/modbus.c index 286b327d..32fec24e 100644 --- a/src/modbus.c +++ b/src/modbus.c @@ -1211,9 +1211,11 @@ int modbus_read_input_registers(modbus_t *ctx, int addr, int nb, } if (nb > MODBUS_MAX_READ_REGISTERS) { - fprintf(stderr, - "ERROR Too many input registers requested (%d > %d)\n", - nb, MODBUS_MAX_READ_REGISTERS); + if (ctx->debug) { + fprintf(stderr, + "ERROR Too many input registers requested (%d > %d)\n", + nb, MODBUS_MAX_READ_REGISTERS); + } errno = EMBMDATA; return -1; }