diff options
-rw-r--r-- | drivers/base/core.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/base/core.c b/drivers/base/core.c index 2499cefdcdf2..ca4bcb8b3938 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -1839,7 +1839,7 @@ EXPORT_SYMBOL_GPL(device_move); | |||
1839 | */ | 1839 | */ |
1840 | void device_shutdown(void) | 1840 | void device_shutdown(void) |
1841 | { | 1841 | { |
1842 | struct device *dev; | 1842 | struct device *dev, *parent; |
1843 | 1843 | ||
1844 | spin_lock(&devices_kset->list_lock); | 1844 | spin_lock(&devices_kset->list_lock); |
1845 | /* | 1845 | /* |
@@ -1856,7 +1856,7 @@ void device_shutdown(void) | |||
1856 | * prevent it from being freed because parent's | 1856 | * prevent it from being freed because parent's |
1857 | * lock is to be held | 1857 | * lock is to be held |
1858 | */ | 1858 | */ |
1859 | get_device(dev->parent); | 1859 | parent = get_device(dev->parent); |
1860 | get_device(dev); | 1860 | get_device(dev); |
1861 | /* | 1861 | /* |
1862 | * Make sure the device is off the kset list, in the | 1862 | * Make sure the device is off the kset list, in the |
@@ -1866,8 +1866,8 @@ void device_shutdown(void) | |||
1866 | spin_unlock(&devices_kset->list_lock); | 1866 | spin_unlock(&devices_kset->list_lock); |
1867 | 1867 | ||
1868 | /* hold lock to avoid race with probe/release */ | 1868 | /* hold lock to avoid race with probe/release */ |
1869 | if (dev->parent) | 1869 | if (parent) |
1870 | device_lock(dev->parent); | 1870 | device_lock(parent); |
1871 | device_lock(dev); | 1871 | device_lock(dev); |
1872 | 1872 | ||
1873 | /* Don't allow any more runtime suspends */ | 1873 | /* Don't allow any more runtime suspends */ |
@@ -1885,11 +1885,11 @@ void device_shutdown(void) | |||
1885 | } | 1885 | } |
1886 | 1886 | ||
1887 | device_unlock(dev); | 1887 | device_unlock(dev); |
1888 | if (dev->parent) | 1888 | if (parent) |
1889 | device_unlock(dev->parent); | 1889 | device_unlock(parent); |
1890 | 1890 | ||
1891 | put_device(dev); | 1891 | put_device(dev); |
1892 | put_device(dev->parent); | 1892 | put_device(parent); |
1893 | 1893 | ||
1894 | spin_lock(&devices_kset->list_lock); | 1894 | spin_lock(&devices_kset->list_lock); |
1895 | } | 1895 | } |