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/mchp48l640.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/mtd/devices/mchp48l640.c b/drivers/mtd/devices/mchp48l640.c index 99400d0fb8c1..b87f7eca3e64 100644 --- a/drivers/mtd/devices/mchp48l640.c +++ b/drivers/mtd/devices/mchp48l640.c @@ -344,8 +344,14 @@ static int mchp48l640_probe(struct spi_device *spi) static int mchp48l640_remove(struct spi_device *spi) { struct mchp48l640_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 const struct of_device_id mchp48l640_of_table[] = { -- 2.30.2