From: Wolfram Sang <wsa@the-dreams.de>
To: Hsin-Yi Wang <hsinyi@chromium.org>
Cc: Ryder Lee <ryder.lee@mediatek.com>,
Jun Gao <jun.gao@mediatek.com>,
linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org,
linux-i2c@vger.kernel.org,
Matthias Brugger <matthias.bgg@gmail.com>,
linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH] i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf()
Date: Fri, 15 Feb 2019 10:25:00 +0100 [thread overview]
Message-ID: <20190215092500.6q3hqnoufyowiqaz@ninjato> (raw)
In-Reply-To: <CAJMQK-jrpnfzKNYh01Pg6QydSSa-=6x44Pj1wwMdXw7G3x-ybA@mail.gmail.com>
[-- Attachment #1.1: Type: text/plain, Size: 1349 bytes --]
On Fri, Feb 15, 2019 at 05:17:27PM +0800, Hsin-Yi Wang wrote:
> Ok, I can add a check in another patch. Should we return NULL pointer
> if msg->len is 0 or print out some warnings? Thanks.
No warning, msg->len == 0 is a valid setting. But interesting question:
I was about to say NULL, but your driver would assume ENOMEM there and
discard the message which is also not correct since msg->len == 0 is a
valid setting. So, should we just return msg->buf then? Will this work
with your driver? Can it handle zero-length transfers?
> On Fri, Feb 15, 2019 at 5:10 PM Wolfram Sang <wsa@the-dreams.de> wrote:
> >
> > On Fri, Feb 15, 2019 at 05:02:02PM +0800, Hsin-Yi Wang wrote:
> > > i2c_get_dma_safe_msg_buf() allocates space based on msg->len. If threshold is
> > > 0 and msg->len is also 0, function makes zero-length allocation, which returns
> > > a special ZERO_SIZE_PTR instead of a NULL pointer, and this will cause later
> > > code to fail. Modify the threshold to > 0 so the function returns NULL pointer.
> > >
> > > Fixes: fc66b39fe36a ("i2c: mediatek: Use DMA safe buffers for i2c transactions")
> > > Signed-off-by: Hsin-Yi Wang <hsinyi@chromium.org>
> >
> > Right. But we need to fix i2c_get_dma_safe_msg_buf(), so it will be
> > handled for all callers. Do you want to add a check if msg->len is 0 or
> > shall I? Both fine for me.
> >
[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
[-- Attachment #2: Type: text/plain, Size: 176 bytes --]
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-02-15 9:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-15 9:02 [PATCH] i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf() Hsin-Yi Wang
2019-02-15 9:09 ` Wolfram Sang
2019-02-15 9:17 ` Hsin-Yi Wang
2019-02-15 9:25 ` Wolfram Sang [this message]
2019-02-15 16:36 ` Wolfram Sang
2019-02-22 6:04 ` Hsin-Yi Wang
2019-03-08 11:29 ` Wolfram Sang
2019-03-08 14:39 ` Hsin-Yi Wang
2019-03-08 14:52 ` Wolfram Sang
2019-03-08 16:22 ` Hsin-Yi Wang
2019-03-09 9:42 ` Wolfram Sang
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=20190215092500.6q3hqnoufyowiqaz@ninjato \
--to=wsa@the-dreams.de \
--cc=hsinyi@chromium.org \
--cc=jun.gao@mediatek.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mediatek@lists.infradead.org \
--cc=matthias.bgg@gmail.com \
--cc=ryder.lee@mediatek.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox