diff options
Diffstat (limited to 'include')
| -rw-r--r-- | include/linux/device.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/include/linux/device.h b/include/linux/device.h index 3bf86d2f9544..56a96e41d2c9 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1063,9 +1063,12 @@ static inline void device_lock_assert(struct device *dev) static inline bool dev_has_sync_state(struct device *dev) { + struct device_driver *drv; + if (!dev) return false; - if (dev->driver && dev->driver->sync_state) + drv = READ_ONCE(dev->driver); + if (drv && drv->sync_state) return true; if (dev->bus && dev->bus->sync_state) return true; |
