On 22-03-21, 15:53, Jie Deng wrote: > On 2021/3/22 14:41, Viresh Kumar wrote: > I think your optimization has problems... > > > > bool err_found = timeout; > > > > for (i = 0; i < nr; i++) { > > /* Detach the ith request from the vq */ > > req = virtqueue_get_buf(vq, &len); > > > > /* > > * Condition (req && req == &reqs[i]) should always meet since > > * we have total nr requests in the vq. > > */ > > if (!err_found && > > (WARN_ON(!(req && req == &reqs[i])) || > > (req->in_hdr.status != VIRTIO_I2C_MSG_OK))) { > > err_found = true; > > continue; > > > Just continue here, the ith buf leaks ? Ahh, this needs to be dropped. You are fight. > > } > > > > i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], err_found); > > > i2c_put_dma_safe_msg_buf(reqs[i].buf, &msgs[i], !err_found); ? Yes again, my mistake :) -- viresh