Re: [PATCH v2] hid-magicmouse: Fix oops after device removal.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 9 Mar 2010, Michael Poole wrote:

> 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@xxxxxxxxxxx>
> ---
>  drivers/hid/hid-magicmouse.c |    7 +++++--
>  1 files changed, 5 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-magicmouse.c b/drivers/hid/hid-magicmouse.c
> index 4a3a94f..c174b64 100644
> --- a/drivers/hid/hid-magicmouse.c
> +++ b/drivers/hid/hid-magicmouse.c
> @@ -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;
> @@ -409,8 +409,11 @@ err_free:
>  
>  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[] = {

Applied, thank you Michael.

-- 
Jiri Kosina
SUSE Labs, Novell Inc.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux