diff options
Diffstat (limited to 'drivers/base/core.c')
-rw-r--r-- | drivers/base/core.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 6bee6af8d8e1..f1290cbd1350 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -56,7 +56,14 @@ static inline int device_is_not_partition(struct device *dev) | |||
56 | */ | 56 | */ |
57 | const char *dev_driver_string(const struct device *dev) | 57 | const char *dev_driver_string(const struct device *dev) |
58 | { | 58 | { |
59 | return dev->driver ? dev->driver->name : | 59 | struct device_driver *drv; |
60 | |||
61 | /* dev->driver can change to NULL underneath us because of unbinding, | ||
62 | * so be careful about accessing it. dev->bus and dev->class should | ||
63 | * never change once they are set, so they don't need special care. | ||
64 | */ | ||
65 | drv = ACCESS_ONCE(dev->driver); | ||
66 | return drv ? drv->name : | ||
60 | (dev->bus ? dev->bus->name : | 67 | (dev->bus ? dev->bus->name : |
61 | (dev->class ? dev->class->name : "")); | 68 | (dev->class ? dev->class->name : "")); |
62 | } | 69 | } |
@@ -987,6 +994,8 @@ done: | |||
987 | device_remove_class_symlinks(dev); | 994 | device_remove_class_symlinks(dev); |
988 | SymlinkError: | 995 | SymlinkError: |
989 | if (MAJOR(dev->devt)) | 996 | if (MAJOR(dev->devt)) |
997 | devtmpfs_delete_node(dev); | ||
998 | if (MAJOR(dev->devt)) | ||
990 | device_remove_sys_dev_entry(dev); | 999 | device_remove_sys_dev_entry(dev); |
991 | devtattrError: | 1000 | devtattrError: |
992 | if (MAJOR(dev->devt)) | 1001 | if (MAJOR(dev->devt)) |
@@ -1728,8 +1737,5 @@ void device_shutdown(void) | |||
1728 | dev->driver->shutdown(dev); | 1737 | dev->driver->shutdown(dev); |
1729 | } | 1738 | } |
1730 | } | 1739 | } |
1731 | kobject_put(sysfs_dev_char_kobj); | ||
1732 | kobject_put(sysfs_dev_block_kobj); | ||
1733 | kobject_put(dev_kobj); | ||
1734 | async_synchronize_full(); | 1740 | async_synchronize_full(); |
1735 | } | 1741 | } |