From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com>
Cc: Mark Brown <broonie@kernel.org>,
"linux-spi@vger.kernel.org" <linux-spi@vger.kernel.org>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 3/3] spi: spi-mem: Add extra sanity checks on the op param
Date: Thu, 20 Sep 2018 13:14:53 +0200 [thread overview]
Message-ID: <20180920131453.66a597fe@bbrezillon> (raw)
In-Reply-To: <VI1PR04MB1038A9979C770938CE7C36B999130@VI1PR04MB1038.eurprd04.prod.outlook.com>
Hi Yogesh,
On Thu, 20 Sep 2018 10:31:16 +0000
Yogesh Narayan Gaur <yogeshnarayan.gaur@nxp.com> wrote:
> >
> > +static bool spi_mem_buswidth_is_valid(u8 buswidth) {
> > + if (hweight8(buswidth) > 1 || buswidth > SPI_MEM_MAX_BUSWIDTH)
>
> Isn't check for lower limit should be '< 1'?
buswidth == 0 is valid if you have nothing to send...
>
> --
> Regards
> Yogesh Gaur
>
> > + return false;
> > +
> > + return true;
> > +}
> > +
> > +static int spi_mem_check_op(const struct spi_mem_op *op) {
> > + if (!op->cmd.buswidth)
> > + return -EINVAL;
> > +
> > + if ((op->addr.nbytes && !op->addr.buswidth) ||
> > + (op->dummy.nbytes && !op->dummy.buswidth) ||
> > + (op->data.nbytes && !op->data.buswidth))
> > + return -EINVAL;
... and I make sure op->data.buswidth != 0 when required here.
Thanks for the review by the way.
Boris
next prev parent reply other threads:[~2018-09-20 11:15 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-20 7:31 [PATCH 0/3] spi: spi-mem: Minor fixes/improvements Boris Brezillon
2018-09-20 7:31 ` [PATCH 1/3] spi: spi-mem: Add missing description for data.nbytes field Boris Brezillon
2018-09-20 19:26 ` Applied "spi: spi-mem: Add missing description for data.nbytes field" to the spi tree Mark Brown
2018-09-20 7:31 ` [PATCH 2/3] spi: spi-mem: Move the DMA-able constraint doc to the kerneldoc header Boris Brezillon
2018-09-20 19:26 ` Applied "spi: spi-mem: Move the DMA-able constraint doc to the kerneldoc header" to the spi tree Mark Brown
2018-09-20 7:31 ` [PATCH 3/3] spi: spi-mem: Add extra sanity checks on the op param Boris Brezillon
2018-09-20 10:31 ` Yogesh Narayan Gaur
2018-09-20 11:14 ` Boris Brezillon [this message]
2018-09-20 19:26 ` Applied "spi: spi-mem: Add extra sanity checks on the op param" to the spi tree Mark Brown
2018-09-25 9:40 ` [PATCH 3/3] spi: spi-mem: Add extra sanity checks on the op param Geert Uytterhoeven
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=20180920131453.66a597fe@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=broonie@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
--cc=yogeshnarayan.gaur@nxp.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;
as well as URLs for NNTP newsgroup(s).