Skip to content

Commit

Permalink
HID: magicmouse: fix oops after device removal
Browse files Browse the repository at this point in the history
Ask the HID core not to register an input device for the mouse.
Fix an oops after removing the device, due to leaving the new
input device registered.

Signed-off-by: Michael Poole <mdpoole@troilus.org>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
  • Loading branch information
Michael Poole authored and Jiri Kosina committed Mar 9, 2010
1 parent a85821f commit 28918c2
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/hid/hid-magicmouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ static int magicmouse_probe(struct hid_device *hdev,
goto err_free;
}

ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_HIDINPUT);
if (ret) {
dev_err(&hdev->dev, "magicmouse hw start failed\n");
goto err_free;
Expand Down Expand Up @@ -409,8 +409,11 @@ static int magicmouse_probe(struct hid_device *hdev,

static void magicmouse_remove(struct hid_device *hdev)
{
struct magicmouse_sc *msc = hid_get_drvdata(hdev);

hid_hw_stop(hdev);
kfree(hid_get_drvdata(hdev));
input_unregister_device(msc->input);
kfree(msc);
}

static const struct hid_device_id magic_mice[] = {
Expand Down

0 comments on commit 28918c2

Please sign in to comment.