summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/spi/spi.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 6ee0f66ddef1..1564914930d8 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -426,10 +426,12 @@ static int spi_remove(struct device *dev)
static void spi_shutdown(struct device *dev)
{
- const struct spi_driver *sdrv = to_spi_driver(dev->driver);
+ if (dev->driver) {
+ const struct spi_driver *sdrv = to_spi_driver(dev->driver);
- if (sdrv->shutdown)
- sdrv->shutdown(to_spi_device(dev));
+ if (sdrv->shutdown)
+ sdrv->shutdown(to_spi_device(dev));
+ }
}
struct bus_type spi_bus_type = {