When an spi driver's remove function returns a non-zero error code nothing happens apart from emitting a generic error message. Make this error message more device specific and return zero instead. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> --- drivers/mtd/devices/sst25l.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/sst25l.c b/drivers/mtd/devices/sst25l.c index b81c3f0b85f9..04062a1f54c1 100644 --- a/drivers/mtd/devices/sst25l.c +++ b/drivers/mtd/devices/sst25l.c @@ -401,8 +401,14 @@ static int sst25l_probe(struct spi_device *spi) static int sst25l_remove(struct spi_device *spi) { struct sst25l_flash *flash = spi_get_drvdata(spi); + int ret; + + ret = mtd_device_unregister(&flash->mtd); + if (ret) + dev_warn(&spi->dev, "Failed to unregister mtd device (%pe)\n", + ERR_PTR(ret)); - return mtd_device_unregister(&flash->mtd); + return 0; } static struct spi_driver sst25l_driver = { -- 2.30.2