diff options
Diffstat (limited to 'drivers/hid/hid-apple.c')
-rw-r--r-- | drivers/hid/hid-apple.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/drivers/hid/hid-apple.c b/drivers/hid/hid-apple.c index feae88b53fcd..bad40b9315b2 100644 --- a/drivers/hid/hid-apple.c +++ b/drivers/hid/hid-apple.c | |||
@@ -349,7 +349,7 @@ static int apple_probe(struct hid_device *hdev, | |||
349 | unsigned int connect_mask = HID_CONNECT_DEFAULT; | 349 | unsigned int connect_mask = HID_CONNECT_DEFAULT; |
350 | int ret; | 350 | int ret; |
351 | 351 | ||
352 | asc = kzalloc(sizeof(*asc), GFP_KERNEL); | 352 | asc = devm_kzalloc(&hdev->dev, sizeof(*asc), GFP_KERNEL); |
353 | if (asc == NULL) { | 353 | if (asc == NULL) { |
354 | hid_err(hdev, "can't alloc apple descriptor\n"); | 354 | hid_err(hdev, "can't alloc apple descriptor\n"); |
355 | return -ENOMEM; | 355 | return -ENOMEM; |
@@ -362,7 +362,7 @@ static int apple_probe(struct hid_device *hdev, | |||
362 | ret = hid_parse(hdev); | 362 | ret = hid_parse(hdev); |
363 | if (ret) { | 363 | if (ret) { |
364 | hid_err(hdev, "parse failed\n"); | 364 | hid_err(hdev, "parse failed\n"); |
365 | goto err_free; | 365 | return ret; |
366 | } | 366 | } |
367 | 367 | ||
368 | if (quirks & APPLE_HIDDEV) | 368 | if (quirks & APPLE_HIDDEV) |
@@ -373,19 +373,10 @@ static int apple_probe(struct hid_device *hdev, | |||
373 | ret = hid_hw_start(hdev, connect_mask); | 373 | ret = hid_hw_start(hdev, connect_mask); |
374 | if (ret) { | 374 | if (ret) { |
375 | hid_err(hdev, "hw start failed\n"); | 375 | hid_err(hdev, "hw start failed\n"); |
376 | goto err_free; | 376 | return ret; |
377 | } | 377 | } |
378 | 378 | ||
379 | return 0; | 379 | return 0; |
380 | err_free: | ||
381 | kfree(asc); | ||
382 | return ret; | ||
383 | } | ||
384 | |||
385 | static void apple_remove(struct hid_device *hdev) | ||
386 | { | ||
387 | hid_hw_stop(hdev); | ||
388 | kfree(hid_get_drvdata(hdev)); | ||
389 | } | 380 | } |
390 | 381 | ||
391 | static const struct hid_device_id apple_devices[] = { | 382 | static const struct hid_device_id apple_devices[] = { |
@@ -545,7 +536,6 @@ static struct hid_driver apple_driver = { | |||
545 | .id_table = apple_devices, | 536 | .id_table = apple_devices, |
546 | .report_fixup = apple_report_fixup, | 537 | .report_fixup = apple_report_fixup, |
547 | .probe = apple_probe, | 538 | .probe = apple_probe, |
548 | .remove = apple_remove, | ||
549 | .event = apple_event, | 539 | .event = apple_event, |
550 | .input_mapping = apple_input_mapping, | 540 | .input_mapping = apple_input_mapping, |
551 | .input_mapped = apple_input_mapped, | 541 | .input_mapped = apple_input_mapped, |