public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Frysinger <vapier@gentoo.org>
To: Adrian McMenamin <adrian@newgolddream.dyndns.info>
Cc: LKML <linux-kernel@vger.kernel.org>,
	"linux-sh" <linux-sh@vger.kernel.org>,
	"linux-input" <linux-input@vger.kernel.org>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Paul Mundt <lethal@linux-sh.org>, Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] sh: maple: add Maple controller as a joystick device
Date: Wed, 24 Dec 2008 11:57:31 -0500	[thread overview]
Message-ID: <200812241157.33912.vapier@gentoo.org> (raw)
In-Reply-To: <1229797614.6502.20.camel@localhost.localdomain>

[-- Attachment #1: Type: text/plain, Size: 1078 bytes --]

On Saturday 20 December 2008 13:26:54 Adrian McMenamin wrote:
> +static int probe_maple_controller(struct device *dev)
> +{
> ...
> +	mdev = to_maple_dev(dev);
> +	if (!mdev) {
> +		error = EINVAL;
> +		goto fail;
> +	}
> +
> +	mdrv = to_maple_driver(dev->driver);
> +	if (!mdrv) {
> +		error = EINVAL;
> +		goto fail;
> +	}

like Dmitry said, these NULL checks make no sense

> +	pad = kzalloc(sizeof(struct dc_pad), GFP_KERNEL);
> +	if (!pad) {
> +		error = ENOMEM;
> +		goto fail;
> +	}
> +	idev = input_allocate_device();
> +	if (!idev){
> +		error = ENOMEM;
> +		goto fail_idev;
> +	}
> ...
> +	error = input_register_device(idev);
> +	if (error)
> +		goto fail_register;
> ...
> +fail_register:
> +	maple_set_drvdata(mdev, NULL);
> +	input_free_device(pad->dev);
> +fail_idev:
> +	kfree(pad);
> +fail:
> +	return -error;
> +}

this -error stuff is weird and i think wrong.  for constants, you're adding 
overhead, and for the input_register_device(), i think you're negating an 
already negative value thus breaking it.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 835 bytes --]

      parent reply	other threads:[~2008-12-24 16:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-20 18:26 [PATCH] sh: maple: add Maple controller as a joystick device Adrian McMenamin
2008-12-20 20:28 ` Dmitry Torokhov
2008-12-24 16:57 ` Mike Frysinger [this message]

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=200812241157.33912.vapier@gentoo.org \
    --to=vapier@gentoo.org \
    --cc=adrian@newgolddream.dyndns.info \
    --cc=akpm@osdl.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox