diff options
| author | Myeonghun Pak <mhun512@gmail.com> | 2026-04-24 15:50:41 +0300 |
|---|---|---|
| committer | Jiri Kosina <jkosina@suse.com> | 2026-05-12 19:01:05 +0300 |
| commit | b08665fe80fab0956e64741c07d9bbcec635c34d (patch) | |
| tree | 5c8efc09d9e3f6cbe1d477b75a4eb4474e973d59 | |
| parent | 1654e53349d4e657b331de354313461f401f5063 (diff) | |
| download | linux-b08665fe80fab0956e64741c07d9bbcec635c34d.tar.xz | |
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>
| -rw-r--r-- | drivers/hid/hid-google-hammer.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c index 1af477e58480..c99c3c0d442e 100644 --- a/drivers/hid/hid-google-hammer.c +++ b/drivers/hid/hid-google-hammer.c @@ -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; |
