Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver
From: Jie Deng <hidden>
Date: 2021-03-02 08:35:34
Also in:
linux-i2c, lkml
On 2021/3/1 20:07, Andy Shevchenko wrote:
On Mon, Mar 01, 2021 at 02:41:35PM +0800, Jie Deng wrote:quoted
Add an I2C bus driver for virtio para-virtualization. The controller can be emulated by the backend driver in any device model software by following the virtio protocol. The device specification can be found on https://lists.oasis-open.org/archives/virtio-comment/202101/msg00008.html. By following the specification, people may implement different backend drivers to emulate different controllers according to their needs....quoted
+ buf = kzalloc(msgs[i].len, GFP_KERNEL); + if (!buf) + break; + + if (msgs[i].flags & I2C_M_RD) {kzalloc()quoted
+ reqs[i].read_buf = buf; + sg_init_one(&msg_buf, reqs[i].read_buf, msgs[i].len); + sgs[outcnt + incnt++] = &msg_buf; + } else { + reqs[i].write_buf = buf; + memcpy(reqs[i].write_buf, msgs[i].buf, msgs[i].len);kmemdup() ?
Do you mean using "kzalloc" in the if condition and "kmemdup" in the else condition ? Then we have to check the NULL twice which is also not good.
quoted
+ sg_init_one(&msg_buf, reqs[i].write_buf, msgs[i].len); + sgs[outcnt++] = &msg_buf; + }...quoted
+ +One blank line is enough.
Will fix it. Thank you.
...quoted
+ ret = virtio_i2c_send_reqs(vq, reqs, msgs, num); + if (ret == 0) + goto err_unlock_free; + elseRedundant.
Good catch !
quoted
+ nr = ret;
_______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization