diff options
author | Axel Lin <axel.lin@ingics.com> | 2013-08-31 08:25:52 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-08-31 12:51:06 -0400 |
commit | e93b07244d6e1d6105df78b6117b00c940006b45 (patch) | |
tree | 505925425d5e1df0e15e5cba534141a6b6d034b3 /drivers/spi/spi.c | |
parent | 96b3eace39d2ecfdb07003856ddd8f6973dfe7bb (diff) |
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 <axel.lin@ingics.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
Diffstat (limited to 'drivers/spi/spi.c')
-rw-r--r-- | drivers/spi/spi.c | 2 |
1 files changed, 1 insertions, 1 deletions
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) | |||
1169 | else { | 1169 | else { |
1170 | status = spi_master_initialize_queue(master); | 1170 | status = spi_master_initialize_queue(master); |
1171 | if (status) { | 1171 | if (status) { |
1172 | device_unregister(&master->dev); | 1172 | device_del(&master->dev); |
1173 | goto done; | 1173 | goto done; |
1174 | } | 1174 | } |
1175 | } | 1175 | } |