diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 7fec76dd532f..3fadc564d781 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -2030,11 +2030,12 @@ void spi_unregister_master(struct spi_master *master) dev_err(&master->dev, "queue remove failed\n"); } + device_for_each_child(&master->dev, NULL, __unregister); + mutex_lock(&board_lock); list_del(&master->list); mutex_unlock(&board_lock); - device_for_each_child(&master->dev, NULL, __unregister); device_unregister(&master->dev); } EXPORT_SYMBOL_GPL(spi_unregister_master);