diff options
Diffstat (limited to 'drivers/base/power/common.c')
-rw-r--r-- | drivers/base/power/common.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/drivers/base/power/common.c b/drivers/base/power/common.c index 39c32529b833..5da914041305 100644 --- a/drivers/base/power/common.c +++ b/drivers/base/power/common.c | |||
@@ -61,24 +61,24 @@ EXPORT_SYMBOL_GPL(dev_pm_get_subsys_data); | |||
61 | int dev_pm_put_subsys_data(struct device *dev) | 61 | int dev_pm_put_subsys_data(struct device *dev) |
62 | { | 62 | { |
63 | struct pm_subsys_data *psd; | 63 | struct pm_subsys_data *psd; |
64 | int ret = 0; | 64 | int ret = 1; |
65 | 65 | ||
66 | spin_lock_irq(&dev->power.lock); | 66 | spin_lock_irq(&dev->power.lock); |
67 | 67 | ||
68 | psd = dev_to_psd(dev); | 68 | psd = dev_to_psd(dev); |
69 | if (!psd) { | 69 | if (!psd) |
70 | ret = -EINVAL; | ||
71 | goto out; | 70 | goto out; |
72 | } | ||
73 | 71 | ||
74 | if (--psd->refcount == 0) { | 72 | if (--psd->refcount == 0) { |
75 | dev->power.subsys_data = NULL; | 73 | dev->power.subsys_data = NULL; |
76 | kfree(psd); | 74 | } else { |
77 | ret = 1; | 75 | psd = NULL; |
76 | ret = 0; | ||
78 | } | 77 | } |
79 | 78 | ||
80 | out: | 79 | out: |
81 | spin_unlock_irq(&dev->power.lock); | 80 | spin_unlock_irq(&dev->power.lock); |
81 | kfree(psd); | ||
82 | 82 | ||
83 | return ret; | 83 | return ret; |
84 | } | 84 | } |