mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-15 20:12:00 -04:00
HID: google: hammer: stop hardware on devres action failure
hammer_probe() starts the HID hardware before registering the devres action that stops it. If devm_add_action() fails, probe returns an error with the hardware still started because the cleanup action was never registered and the driver's remove callback is not called after a failed probe. Use devm_add_action_or_reset() so the stop action runs immediately on registration failure while preserving the existing devres-managed cleanup path for later probe failures and remove. Signed-off-by: Myeonghun Pak <mhun512@gmail.com> Signed-off-by: Jiri Kosina <jkosina@suse.com>
This commit is contained in:
committed by
Jiri Kosina
parent
1654e53349
commit
b08665fe80
@@ -496,7 +496,7 @@ static int hammer_probe(struct hid_device *hdev,
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
error = devm_add_action(&hdev->dev, hammer_stop, hdev);
|
||||
error = devm_add_action_or_reset(&hdev->dev, hammer_stop, hdev);
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user