Re: [RFC 03/12] HID: wiimote: Add wiimote device structure

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

 



Am Mittwoch, 15. Juni 2011, 01:45:48 schrieb David Herrmann:
>  static int wiimote_hid_probe(struct hid_device *hdev,
>                                 const struct hid_device_id *id)
>  {
> +       struct wiimote_data *wdata;
>         int ret;
>  
> +       wdata = wiimote_create(hdev);
> +       if (!wdata) {
> +               hid_err(hdev, "Can't alloc device\n");
> +               return -ENOMEM;
> +       }
> +
>         ret = hid_parse(hdev);
>         if (ret) {
>                 hid_err(hdev, "HID parse failed\n");
> -               return ret;
> +               goto err;
>         }
>  
>         ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW);
>         if (ret) {
>                 hid_err(hdev, "HW start failed\n");
> -               return ret;
> +               goto err;
>         }
>  
>         hid_info(hdev, "New device registered\n");
>         return 0;
> +
> +err:
> +       kfree(wdata);
> +       return ret;
>  }


If you create wiimote_create(), you should for symmetry's sake also
create wiimote_destroy() encapsulating the kfree.

	Regards
		Oliver
--
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