diff options
-rw-r--r-- | drivers/base/power/wakeup.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/base/power/wakeup.c b/drivers/base/power/wakeup.c index 973675f24314..036469528f88 100644 --- a/drivers/base/power/wakeup.c +++ b/drivers/base/power/wakeup.c | |||
@@ -137,6 +137,13 @@ static void wakeup_source_record(struct wakeup_source *ws) | |||
137 | spin_unlock_irqrestore(&deleted_ws.lock, flags); | 137 | spin_unlock_irqrestore(&deleted_ws.lock, flags); |
138 | } | 138 | } |
139 | 139 | ||
140 | static void wakeup_source_free(struct wakeup_source *ws) | ||
141 | { | ||
142 | ida_free(&wakeup_ida, ws->id); | ||
143 | kfree_const(ws->name); | ||
144 | kfree(ws); | ||
145 | } | ||
146 | |||
140 | /** | 147 | /** |
141 | * wakeup_source_destroy - Destroy a struct wakeup_source object. | 148 | * wakeup_source_destroy - Destroy a struct wakeup_source object. |
142 | * @ws: Wakeup source to destroy. | 149 | * @ws: Wakeup source to destroy. |
@@ -150,9 +157,7 @@ void wakeup_source_destroy(struct wakeup_source *ws) | |||
150 | 157 | ||
151 | __pm_relax(ws); | 158 | __pm_relax(ws); |
152 | wakeup_source_record(ws); | 159 | wakeup_source_record(ws); |
153 | ida_free(&wakeup_ida, ws->id); | 160 | wakeup_source_free(ws); |
154 | kfree_const(ws->name); | ||
155 | kfree(ws); | ||
156 | } | 161 | } |
157 | EXPORT_SYMBOL_GPL(wakeup_source_destroy); | 162 | EXPORT_SYMBOL_GPL(wakeup_source_destroy); |
158 | 163 | ||
@@ -217,7 +222,7 @@ struct wakeup_source *wakeup_source_register(struct device *dev, | |||
217 | if (ws) { | 222 | if (ws) { |
218 | ret = wakeup_source_sysfs_add(dev, ws); | 223 | ret = wakeup_source_sysfs_add(dev, ws); |
219 | if (ret) { | 224 | if (ret) { |
220 | wakeup_source_destroy(ws); | 225 | wakeup_source_free(ws); |
221 | return NULL; | 226 | return NULL; |
222 | } | 227 | } |
223 | wakeup_source_add(ws); | 228 | wakeup_source_add(ws); |