> + > + for (i = 0 ; i < count ; i++, data++) { > + dev_err(dev, ": 0x%02x, %02d, 0x%08llx, 0x%04x, %d, %llu, %llu, > 0x%llx", > + data->op, data->tag, data->lba, data->sct, data->retries, > + data->start_time, data->end_time, data- > >outstanding_reqs); > + idx = (idx == MAX_CMD_LOGS - 1) ? 0 : idx + 1; > + } Maybe just outside of the loop: idx += count; idx %= (MAX_CMD_LOGS - 1);