spi: Handle SPI device setup callback failure.
If the setup callback failed, but the controller has auto_runtime_pm and set_cs, the setup failure could be missed. Signed-off-by: Joe Burmeister <joe.burmeister@devtank.co.uk> Link: https://lore.kernel.org/r/20210419130631.4586-1-joe.burmeister@devtank.co.uk Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
d347b4aaa1
commit
c914dbf88f
|
@ -3378,8 +3378,15 @@ int spi_setup(struct spi_device *spi)
|
|||
|
||||
mutex_lock(&spi->controller->io_mutex);
|
||||
|
||||
if (spi->controller->setup)
|
||||
if (spi->controller->setup) {
|
||||
status = spi->controller->setup(spi);
|
||||
if (status) {
|
||||
mutex_unlock(&spi->controller->io_mutex);
|
||||
dev_err(&spi->controller->dev, "Failed to setup device: %d\n",
|
||||
status);
|
||||
return status;
|
||||
}
|
||||
}
|
||||
|
||||
if (spi->controller->auto_runtime_pm && spi->controller->set_cs) {
|
||||
status = pm_runtime_get_sync(spi->controller->dev.parent);
|
||||
|
|
Loading…
Reference in New Issue