From: Axel Lin Date: Sat, 31 Aug 2013 12:25:52 +0000 (+0800) Subject: spi: core: Fix spi_register_master error handling X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=e93b07244d6e1d6105df78b6117b00c940006b45;p=openwrt%2Fstaging%2Fblogic.git spi: core: Fix spi_register_master error handling In the case spi_master_initialize_queue() fails, current code calls device_unregister() before return error from spi_register_master(). However, all the drivers call spi_master_put() in the error path if spi_register_master() fails. Thus we should call device_del() rather than device_unregister() before return error from spi_register_master(). This also makes all the spi_register_master() error handling consistent, because all other error paths of spi_register_master() expect drivers to call spi_master_put() if spi_register_master() fails. Signed-off-by: Axel Lin Signed-off-by: Mark Brown --- diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index b1db83f1b4aa..f56017ea55e9 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1169,7 +1169,7 @@ int spi_register_master(struct spi_master *master) else { status = spi_master_initialize_queue(master); if (status) { - device_unregister(&master->dev); + device_del(&master->dev); goto done; } }