[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <nycvar.YFH.7.76.2010291622380.18859@cbobk.fhfr.pm>
Date: Thu, 29 Oct 2020 16:25:43 +0100 (CET)
From: Jiri Kosina <jikos@...nel.org>
To: Pascal Giard <pascal.giard@...mtl.ca>
cc: Benjamin Tissoires <benjamin.tissoires@...hat.com>,
linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
Sanjay Govind <sanjay.govind9@...il.com>
Subject: Re: [PATCH] HID: ghlive: support for ghlive ps3/wii u dongles
On Thu, 8 Oct 2020, Pascal Giard wrote:
> This commit introduces the Guitar Hero Live driver which adds support
> for the PS3 and Wii U dongles.
Pascal,
thanks for the patch.
[ ... snip ... ]
> ---
> drivers/hid/Kconfig | 6 ++
> drivers/hid/Makefile | 1 +
> drivers/hid/hid-ghlive.c | 220 +++++++++++++++++++++++++++++++++++++++
Would it make more sense (with respect to how we are structuring/naming
the hid drivers) to incorporate this into hid-sony (irrespective of
currently ongoing discussions about actually splitting that driver :) )?
> +static void ghl_magic_poke(struct timer_list *t)
> +{
> + struct ghlive_sc *sc = from_timer(sc, t, poke_timer);
> +
> + int ret;
> + unsigned int pipe;
> + struct urb *urb;
> + struct usb_ctrlrequest *cr;
> + const u16 poke_size =
> + ARRAY_SIZE(ghl_ps3wiiu_magic_data);
> + u8 *databuf;
> +
> + pipe = usb_sndctrlpipe(sc->usbdev, 0);
> +
> + cr = kzalloc(sizeof(*cr), GFP_ATOMIC);
> + if (!cr)
> + goto resched;
> +
> + databuf = kzalloc(poke_size, GFP_ATOMIC);
> + if (!databuf) {
> + kfree(cr);
> + goto resched;
> + }
> +
> + urb = usb_alloc_urb(0, GFP_ATOMIC);
> + if (!urb) {
> + kfree(databuf);
> + kfree(cr);
> + goto resched;
So if one of the allocations above succeeds and a subsequent one fails,
you're going to try re-allocate all of them next time again, leaking the
ones that previously succeeded, right?
Thanks,
--
Jiri Kosina
SUSE Labs
Powered by blists - more mailing lists