* [PATCH] mtd: devices: m25p80: Use spi_mem_set_drvdata() instead of spi_set_drvdata()
@ 2018-05-22 10:55 Boris Brezillon
0 siblings, 0 replies; only message in thread
From: Boris Brezillon @ 2018-05-22 10:55 UTC (permalink / raw)
To: Mark Brown, linux-spi
Cc: Geert Uytterhoeven, Marek Vasut, Richard Weinberger,
Boris Brezillon, linux-mtd, Brian Norris, David Woodhouse
SPI mem drivers should use spi_mem_set_drvdata() not spi_set_drvdata()
to store their private data. Using spi_set_drvdata() will mess the
spi -> spi-mem link up and cause a kernel panic at shutdown or
device removal time.
Fixes: 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx() API")
Reported-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Marek Vasut <marek.vasut+renesas@gmail.com> on R8A7791 Porter
---
Hi Mark,
Could you take this patch through the SPI tree? The bug has been
introduced by 4120f8d158ef ("mtd: spi-nor: Use the spi_mem_xx() API")
which is in the spi/for-4.18 branch (I didn't pull these changes in the
MTD tree yet, and if possible I'd like to avoid doing that unless we
end up with a conflict between the MTD and SPI tree).
Let me know if that's not possible and I'll find another solution (wait
-rc1 or merge the spi/for-4.18 branch into the MTD tree).
Thanks,
Boris
---
drivers/mtd/devices/m25p80.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 3dc022d3b53e..e84563d2067f 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -182,7 +182,7 @@ static int m25p_probe(struct spi_mem *spimem)
spi_nor_set_flash_node(nor, spi->dev.of_node);
nor->priv = flash;
- spi_set_drvdata(spi, flash);
+ spi_mem_set_drvdata(spimem, flash);
flash->spimem = spimem;
if (spi->mode & SPI_RX_QUAD) {
--
2.14.1
______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2018-05-22 10:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-22 10:55 [PATCH] mtd: devices: m25p80: Use spi_mem_set_drvdata() instead of spi_set_drvdata() Boris Brezillon
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).