From: Ian Abbott <abbotti@mev.co.uk>
To: barebox@lists.infradead.org
Cc: Ian Abbott <abbotti@mev.co.uk>
Subject: [PATCH] mtd: spi-nor: cadence: fix csqpi corruption in cqspi_set_protocol
Date: Wed, 16 Sep 2020 17:23:17 +0100 [thread overview]
Message-ID: <20200916162317.5270-1-abbotti@mev.co.uk> (raw)
cqspi_set_protocol() sets `inst_width`, `addr_width` and `data_width`
for the previous chip-select in `cqspi->current_cs`, but that is
initially set to -1, leading to corruption of other `cqspi->` members.
Change it to set `inst_width`, `addr_width` and `data_width` for the
chip-select associated with the `nor` parameter.
Fixes: 5085d2ef3fbf ("mtd: spi-nor: cadence: add cqspi_set_protocol")
Signed-off-by: Ian Abbott <abbotti@mev.co.uk>
---
drivers/mtd/spi-nor/cadence-quadspi.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/spi-nor/cadence-quadspi.c b/drivers/mtd/spi-nor/cadence-quadspi.c
index 11e4d236d..2372482ac 100644
--- a/drivers/mtd/spi-nor/cadence-quadspi.c
+++ b/drivers/mtd/spi-nor/cadence-quadspi.c
@@ -896,8 +896,12 @@ static int cqspi_set_protocol(struct spi_nor *nor, const int read)
{
struct cqspi_st *cqspi = nor->priv;
struct cqspi_flash_pdata *f_pdata;
+ int cs = cqspi_find_chipselect(nor);
- f_pdata = &cqspi->f_pdata[cqspi->current_cs];
+ if (cs < 0)
+ return -EINVAL;
+
+ f_pdata = &cqspi->f_pdata[cs];
f_pdata->inst_width = CQSPI_INST_TYPE_SINGLE;
f_pdata->addr_width = CQSPI_INST_TYPE_SINGLE;
--
2.28.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2020-09-16 16:23 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-16 16:23 Ian Abbott [this message]
2020-09-18 9:46 ` Sascha Hauer
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=20200916162317.5270-1-abbotti@mev.co.uk \
--to=abbotti@mev.co.uk \
--cc=barebox@lists.infradead.org \
/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