All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jie Deng <jie.deng@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-i2c@vger.kernel.org,
	virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, mst@redhat.com, wsa@kernel.org,
	jasowang@redhat.com, wsa+renesas@sang-engineering.com,
	conghui.chen@intel.com, arnd@arndb.de, kblaiech@mellanox.com,
	jarkko.nikula@linux.intel.com, Sergey.Semin@baikalelectronics.ru,
	rppt@kernel.org, loic.poulain@linaro.org, tali.perry1@gmail.com,
	u.kleine-koenig@pengutronix.de, bjorn.andersson@linaro.org,
	yu1.wang@intel.com, shuo.a.liu@intel.com,
	viresh.kumar@linaro.org
Subject: Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver
Date: Tue, 2 Mar 2021 15:16:03 +0800	[thread overview]
Message-ID: <5888846c-cc7b-44b1-98df-9fa10d89a3ff@intel.com> (raw)
In-Reply-To: <YDzZHKdrpROgSdg3@smile.fi.intel.com>


On 2021/3/1 20:07, Andy Shevchenko wrote:
> On Mon, Mar 01, 2021 at 02:41:35PM +0800, Jie Deng wrote:
>> 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.
> ...
>
>> +		buf = kzalloc(msgs[i].len, GFP_KERNEL);
>> +		if (!buf)
>> +			break;
>> +
>> +		if (msgs[i].flags & I2C_M_RD) {
> kzalloc()
>
>> +			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.
>> +			sg_init_one(&msg_buf, reqs[i].write_buf, msgs[i].len);
>> +			sgs[outcnt++] = &msg_buf;
>> +		}
> ...
>
>> +
>> +
> One blank line is enough.
Will fix it. Thank you.
> ...
>
>
>> +	ret = virtio_i2c_send_reqs(vq, reqs, msgs, num);
>> +	if (ret == 0)
>> +		goto err_unlock_free;
>> +	else
> Redundant.
Good catch !
>> +		nr = ret;

WARNING: multiple messages have this Message-ID (diff)
From: Jie Deng <jie.deng@intel.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Sergey.Semin@baikalelectronics.ru, bjorn.andersson@linaro.org,
	loic.poulain@linaro.org, yu1.wang@intel.com, arnd@arndb.de,
	mst@redhat.com, viresh.kumar@linaro.org, shuo.a.liu@intel.com,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org, wsa@kernel.org,
	wsa+renesas@sang-engineering.com, jarkko.nikula@linux.intel.com,
	linux-i2c@vger.kernel.org, u.kleine-koenig@pengutronix.de,
	kblaiech@mellanox.com, tali.perry1@gmail.com,
	conghui.chen@intel.com, rppt@kernel.org
Subject: Re: [PATCH v5] i2c: virtio: add a virtio i2c frontend driver
Date: Tue, 2 Mar 2021 15:16:03 +0800	[thread overview]
Message-ID: <5888846c-cc7b-44b1-98df-9fa10d89a3ff@intel.com> (raw)
In-Reply-To: <YDzZHKdrpROgSdg3@smile.fi.intel.com>


On 2021/3/1 20:07, Andy Shevchenko wrote:
> On Mon, Mar 01, 2021 at 02:41:35PM +0800, Jie Deng wrote:
>> 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.
> ...
>
>> +		buf = kzalloc(msgs[i].len, GFP_KERNEL);
>> +		if (!buf)
>> +			break;
>> +
>> +		if (msgs[i].flags & I2C_M_RD) {
> kzalloc()
>
>> +			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.
>> +			sg_init_one(&msg_buf, reqs[i].write_buf, msgs[i].len);
>> +			sgs[outcnt++] = &msg_buf;
>> +		}
> ...
>
>> +
>> +
> One blank line is enough.
Will fix it. Thank you.
> ...
>
>
>> +	ret = virtio_i2c_send_reqs(vq, reqs, msgs, num);
>> +	if (ret == 0)
>> +		goto err_unlock_free;
>> +	else
> Redundant.
Good catch !
>> +		nr = ret;
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

  reply	other threads:[~2021-03-03  1:20 UTC|newest]

Thread overview: 50+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-01  6:41 [PATCH v5] i2c: virtio: add a virtio i2c frontend driver Jie Deng
2021-03-01  6:41 ` Jie Deng
2021-03-01 11:54 ` Viresh Kumar
2021-03-01 12:09   ` Andy Shevchenko
2021-03-01 12:09     ` Andy Shevchenko
2021-03-01 12:10     ` Andy Shevchenko
2021-03-01 12:10       ` Andy Shevchenko
2021-03-01 15:46       ` Arnd Bergmann
2021-03-01 15:46         ` Arnd Bergmann
2021-03-02  3:46         ` Viresh Kumar
2021-03-02  3:44       ` Viresh Kumar
2021-03-02  2:21   ` Jie Deng
2021-03-02  2:21     ` Jie Deng
2021-03-02  3:43     ` Viresh Kumar
2021-03-02  6:24       ` Jie Deng
2021-03-02  7:24         ` Viresh Kumar
2021-03-02  8:17           ` Jie Deng
2021-03-02  8:17             ` Jie Deng
2021-03-02  6:28       ` Jie Deng
2021-03-02  6:28         ` Jie Deng
2021-03-01 12:07 ` Andy Shevchenko
2021-03-01 12:07   ` Andy Shevchenko
2021-03-02  7:16   ` Jie Deng [this message]
2021-03-02  7:16     ` Jie Deng
2021-03-01 15:19 ` Arnd Bergmann
2021-03-01 15:19   ` Arnd Bergmann
2021-03-02  2:42   ` Jie Deng
2021-03-02  9:51     ` Stefan Hajnoczi
2021-03-02  9:51       ` Stefan Hajnoczi
2021-03-02 10:54       ` Arnd Bergmann
2021-03-02 10:54         ` Arnd Bergmann
2021-03-03 17:48         ` Stefan Hajnoczi
2021-03-03 17:48           ` Stefan Hajnoczi
2021-03-02  4:01   ` Viresh Kumar
2021-03-02  4:22     ` Viresh Kumar
2021-03-02  5:06       ` Jie Deng
2021-03-02  5:06         ` Jie Deng
2021-03-02  5:16         ` Viresh Kumar
2021-03-02  5:42           ` Jason Wang
2021-03-02  5:42             ` Jason Wang
2021-03-02  4:42 ` Viresh Kumar
2021-03-02  5:21   ` Jie Deng
2021-03-02  5:21     ` Jie Deng
2021-03-02  5:25     ` Viresh Kumar
2021-03-03  7:54 ` Viresh Kumar
2021-03-03  8:46   ` Jie Deng
2021-03-03  8:46     ` Jie Deng
2021-03-03  9:38     ` Viresh Kumar
2021-03-04  1:47       ` Jie Deng
2021-03-04  1:47         ` Jie Deng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5888846c-cc7b-44b1-98df-9fa10d89a3ff@intel.com \
    --to=jie.deng@intel.com \
    --cc=Sergey.Semin@baikalelectronics.ru \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=bjorn.andersson@linaro.org \
    --cc=conghui.chen@intel.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jasowang@redhat.com \
    --cc=kblaiech@mellanox.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loic.poulain@linaro.org \
    --cc=mst@redhat.com \
    --cc=rppt@kernel.org \
    --cc=shuo.a.liu@intel.com \
    --cc=tali.perry1@gmail.com \
    --cc=u.kleine-koenig@pengutronix.de \
    --cc=viresh.kumar@linaro.org \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=wsa+renesas@sang-engineering.com \
    --cc=wsa@kernel.org \
    --cc=yu1.wang@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.