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@xxxxxxxxx> Signed-off-by: Boris Brezillon <boris.brezillon@xxxxxxxxxxx> Tested-by: Geert Uytterhoeven <geert+renesas@xxxxxxxxx> Tested-by: Marek Vasut <marek.vasut+renesas@xxxxxxxxx> 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 -- To unsubscribe from this list: send the line "unsubscribe linux-spi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html