From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Geert Uytterhoeven <geert+renesas@glider.be>
Cc: Mark Brown <broonie@kernel.org>,
David Woodhouse <dwmw2@infradead.org>,
Brian Norris <computersforpeace@gmail.com>,
Marek Vasut <marek.vasut@gmail.com>,
Richard Weinberger <richard@nod.at>,
linux-spi@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-renesas-soc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] spi: spi-mem: Fix inverted logic in op sanity check
Date: Tue, 25 Sep 2018 11:58:23 +0200 [thread overview]
Message-ID: <20180925115823.3dd07cda@bbrezillon> (raw)
In-Reply-To: <20180925094655.11438-1-geert+renesas@glider.be>
On Tue, 25 Sep 2018 11:46:55 +0200
Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> On r8a7791/koelsch:
>
> m25p80 spi0.0: error -22 reading 9f
> m25p80: probe of spi0.0 failed with error -22
>
> Apparently the logic in spi_mem_check_op() is wrong, rejecting the
> spi-mem operation if any buswidth is valid, instead of invalid.
>
> Fixes: 380583227c0c7f52 ("spi: spi-mem: Add extra sanity checks on the op param")
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Sorry for the mess :-/, and thanks for reporting/fixing it.
> ---
> drivers/spi/spi-mem.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/spi/spi-mem.c b/drivers/spi/spi-mem.c
> index cc3d425aae56c634..62a7b80801d22098 100644
> --- a/drivers/spi/spi-mem.c
> +++ b/drivers/spi/spi-mem.c
> @@ -169,10 +169,10 @@ static int spi_mem_check_op(const struct spi_mem_op *op)
> (op->data.nbytes && !op->data.buswidth))
> return -EINVAL;
>
> - if (spi_mem_buswidth_is_valid(op->cmd.buswidth) ||
> - spi_mem_buswidth_is_valid(op->addr.buswidth) ||
> - spi_mem_buswidth_is_valid(op->dummy.buswidth) ||
> - spi_mem_buswidth_is_valid(op->data.buswidth))
> + if (!spi_mem_buswidth_is_valid(op->cmd.buswidth) ||
> + !spi_mem_buswidth_is_valid(op->addr.buswidth) ||
> + !spi_mem_buswidth_is_valid(op->dummy.buswidth) ||
> + !spi_mem_buswidth_is_valid(op->data.buswidth))
> return -EINVAL;
>
> return 0;
next prev parent reply other threads:[~2018-09-25 9:58 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-25 9:46 [PATCH] spi: spi-mem: Fix inverted logic in op sanity check Geert Uytterhoeven
2018-09-25 9:58 ` Boris Brezillon [this message]
2018-09-27 22:40 ` Applied "spi: spi-mem: Fix inverted logic in op sanity check" to the spi tree Mark Brown
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=20180925115823.3dd07cda@bbrezillon \
--to=boris.brezillon@bootlin.com \
--cc=broonie@kernel.org \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=geert+renesas@glider.be \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=marek.vasut@gmail.com \
--cc=richard@nod.at \
/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).