aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSzymon Janc <szymon@janc.net.pl>2012-01-11 17:22:42 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-08 20:16:49 -0500
commitf27a551968bb8780c8a5255c0ea6c3a2fcaf4a47 (patch)
tree38ae528a8b4404fae1bfa57e2aa838535edd7ab5 /drivers
parent60955f15d93198ef33081e01f46223c7bd534f1e (diff)
Staging: quickstart: Cleanup quickstart_acpi_add
Signed-off-by: Szymon Janc <szymon@janc.net.pl> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/quickstart/quickstart.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/drivers/staging/quickstart/quickstart.c b/drivers/staging/quickstart/quickstart.c
index de98e18f9b4..97e62e9faf6 100644
--- a/drivers/staging/quickstart/quickstart.c
+++ b/drivers/staging/quickstart/quickstart.c
@@ -262,29 +262,29 @@ static int quickstart_acpi_config(struct quickstart_acpi *quickstart, char *bid)
262 262
263static int quickstart_acpi_add(struct acpi_device *device) 263static int quickstart_acpi_add(struct acpi_device *device)
264{ 264{
265 int ret = 0; 265 int ret;
266 acpi_status status = AE_OK; 266 acpi_status status;
267 struct quickstart_acpi *quickstart = NULL; 267 struct quickstart_acpi *quickstart;
268 268
269 if (!device) 269 if (!device)
270 return -EINVAL; 270 return -EINVAL;
271 271
272 quickstart = kzalloc(sizeof(struct quickstart_acpi), GFP_KERNEL); 272 quickstart = kzalloc(sizeof(*quickstart), GFP_KERNEL);
273 if (!quickstart) 273 if (!quickstart)
274 return -ENOMEM; 274 return -ENOMEM;
275 275
276 quickstart->device = device; 276 quickstart->device = device;
277
277 strcpy(acpi_device_name(device), QUICKSTART_ACPI_DEVICE_NAME); 278 strcpy(acpi_device_name(device), QUICKSTART_ACPI_DEVICE_NAME);
278 strcpy(acpi_device_class(device), QUICKSTART_ACPI_CLASS); 279 strcpy(acpi_device_class(device), QUICKSTART_ACPI_CLASS);
279 device->driver_data = quickstart; 280 device->driver_data = quickstart;
280 281
281 /* Add button to list and initialize some stuff */ 282 /* Add button to list and initialize some stuff */
282 ret = quickstart_acpi_config(quickstart, acpi_device_bid(device)); 283 ret = quickstart_acpi_config(quickstart, acpi_device_bid(device));
283 if (ret) 284 if (ret < 0)
284 goto fail_config; 285 goto fail_config;
285 286
286 status = acpi_install_notify_handler(device->handle, 287 status = acpi_install_notify_handler(device->handle, ACPI_ALL_NOTIFY,
287 ACPI_ALL_NOTIFY,
288 quickstart_acpi_notify, 288 quickstart_acpi_notify,
289 quickstart); 289 quickstart);
290 if (ACPI_FAILURE(status)) { 290 if (ACPI_FAILURE(status)) {
@@ -293,10 +293,16 @@ static int quickstart_acpi_add(struct acpi_device *device)
293 goto fail_installnotify; 293 goto fail_installnotify;
294 } 294 }
295 295
296 quickstart_acpi_ghid(quickstart); 296 ret = quickstart_acpi_ghid(quickstart);
297 if (ret < 0)
298 goto fail_ghid;
297 299
298 return 0; 300 return 0;
299 301
302fail_ghid:
303 acpi_remove_notify_handler(device->handle, ACPI_ALL_NOTIFY,
304 quickstart_acpi_notify);
305
300fail_installnotify: 306fail_installnotify:
301 quickstart_btnlst_del(quickstart->btn); 307 quickstart_btnlst_del(quickstart->btn);
302 308