Re: [PATCH] HID: google: hammer: stop hardware on devres action failure
From: Myeonghun Pak
Date: Wed May 13 2026 - 02:52:30 EST
Dear Jiri,
Thanks for applying the patch.
Best regards,
Myeonghun
2026년 5월 13일 (수) 오전 1:01, Jiri Kosina <jikos@xxxxxxxxxx>님이 작성:
>
> On Fri, 24 Apr 2026, 박명훈 wrote:
>
> > From: Myeonghun Pak <mhun512@xxxxxxxxx>
> >
> > 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@xxxxxxxxx>
> > ---
> > drivers/hid/hid-google-hammer.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c
> > index 1af477e584..c99c3c0d44 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);
>
> Makes sense, thanks for catching it. Applied.
>
> --
> Jiri Kosina
> SUSE Labs
>