Skip to content

Commit

Permalink
carl9170: devres-ing input_allocate_device
Browse files Browse the repository at this point in the history
devres will take care of freeing the input_device once
it is no longer needed.

Signed-off-by: Christian Lamparter <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
Link: https://lore.kernel.org/r/f81a6ff3b02116c6a448c42eecb546ea5d46c108.1646250537.git.chunkeey@gmail.com
  • Loading branch information
chunkeey authored and kvalo committed Mar 10, 2022
1 parent 23de0fa commit 87ddb2f
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions drivers/net/wireless/ath/carl9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1494,7 +1494,7 @@ static int carl9170_register_wps_button(struct ar9170 *ar)
if (!(ar->features & CARL9170_WPS_BUTTON))
return 0;

input = input_allocate_device();
input = devm_input_allocate_device(&ar->udev->dev);
if (!input)
return -ENOMEM;

Expand All @@ -1512,10 +1512,8 @@ static int carl9170_register_wps_button(struct ar9170 *ar)
input_set_capability(input, EV_KEY, KEY_WPS_BUTTON);

err = input_register_device(input);
if (err) {
input_free_device(input);
if (err)
return err;
}

ar->wps.pbc = input;
return 0;
Expand Down Expand Up @@ -2038,13 +2036,6 @@ void carl9170_unregister(struct ar9170 *ar)
carl9170_debugfs_unregister(ar);
#endif /* CONFIG_CARL9170_DEBUGFS */

#ifdef CONFIG_CARL9170_WPC
if (ar->wps.pbc) {
input_unregister_device(ar->wps.pbc);
ar->wps.pbc = NULL;
}
#endif /* CONFIG_CARL9170_WPC */

carl9170_cancel_worker(ar);
cancel_work_sync(&ar->restart_work);

Expand Down

0 comments on commit 87ddb2f

Please sign in to comment.