diff options
Diffstat (limited to 'drivers/base/core.c')
-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 c7cfadcf6752..34abf4d8a45f 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -2017,7 +2017,7 @@ EXPORT_SYMBOL_GPL(device_move); | |||
2017 | */ | 2017 | */ |
2018 | void device_shutdown(void) | 2018 | void device_shutdown(void) |
2019 | { | 2019 | { |
2020 | struct device *dev; | 2020 | struct device *dev, *parent; |
2021 | 2021 | ||
2022 | spin_lock(&devices_kset->list_lock); | 2022 | spin_lock(&devices_kset->list_lock); |
2023 | /* | 2023 | /* |
@@ -2034,7 +2034,7 @@ void device_shutdown(void) | |||
2034 | * prevent it from being freed because parent's | 2034 | * prevent it from being freed because parent's |
2035 | * lock is to be held | 2035 | * lock is to be held |
2036 | */ | 2036 | */ |
2037 | get_device(dev->parent); | 2037 | parent = get_device(dev->parent); |
2038 | get_device(dev); | 2038 | get_device(dev); |
2039 | /* | 2039 | /* |
2040 | * Make sure the device is off the kset list, in the | 2040 | * Make sure the device is off the kset list, in the |
@@ -2044,8 +2044,8 @@ void device_shutdown(void) | |||
2044 | spin_unlock(&devices_kset->list_lock); | 2044 | spin_unlock(&devices_kset->list_lock); |
2045 | 2045 | ||
2046 | /* hold lock to avoid race with probe/release */ | 2046 | /* hold lock to avoid race with probe/release */ |
2047 | if (dev->parent) | 2047 | if (parent) |
2048 | device_lock(dev->parent); | 2048 | device_lock(parent); |
2049 | device_lock(dev); | 2049 | device_lock(dev); |
2050 | 2050 | ||
2051 | /* Don't allow any more runtime suspends */ | 2051 | /* Don't allow any more runtime suspends */ |
@@ -2063,11 +2063,11 @@ void device_shutdown(void) | |||
2063 | } | 2063 | } |
2064 | 2064 | ||
2065 | device_unlock(dev); | 2065 | device_unlock(dev); |
2066 | if (dev->parent) | 2066 | if (parent) |
2067 | device_unlock(dev->parent); | 2067 | device_unlock(parent); |
2068 | 2068 | ||
2069 | put_device(dev); | 2069 | put_device(dev); |
2070 | put_device(dev->parent); | 2070 | put_device(parent); |
2071 | 2071 | ||
2072 | spin_lock(&devices_kset->list_lock); | 2072 | spin_lock(&devices_kset->list_lock); |
2073 | } | 2073 | } |