All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jiri Kosina <jikos@kernel.org>
To: Pascal Giard <pascal.giard@etsmtl.ca>
Cc: Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sanjay Govind <sanjay.govind9@gmail.com>
Subject: Re: [PATCH] HID: ghlive: support for ghlive ps3/wii u dongles
Date: Thu, 29 Oct 2020 16:25:43 +0100 (CET)	[thread overview]
Message-ID: <nycvar.YFH.7.76.2010291622380.18859@cbobk.fhfr.pm> (raw)
In-Reply-To: <20201009022722.123943-1-pascal.giard@etsmtl.ca>

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


  reply	other threads:[~2020-10-29 15:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-09  2:27 [PATCH] HID: ghlive: support for ghlive ps3/wii u dongles Pascal Giard
2020-10-29 15:25 ` Jiri Kosina [this message]
2020-10-29 18:35   ` Pascal Giard
2020-11-03 10:55     ` Jiri Kosina
2020-11-08  1:38 ` [PATCH v2] HID: sony: " Pascal Giard
2020-11-25 13:24   ` Jiri Kosina
2020-11-26  3:02   ` [PATCH v3] " Pascal Giard
2020-11-27 14:50     ` Jiri Kosina

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.YFH.7.76.2010291622380.18859@cbobk.fhfr.pm \
    --to=jikos@kernel.org \
    --cc=benjamin.tissoires@redhat.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pascal.giard@etsmtl.ca \
    --cc=sanjay.govind9@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.