linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jean Delvare <khali@linux-fr.org>
To: Mike Rapoport <mike@compulab.co.il>
Cc: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	grinberg@compulab.co.il, linux-input@vger.kernel.org
Subject: Re: [PATCH] input: add synaptics_i2c driver
Date: Thu, 14 May 2009 16:28:42 +0200	[thread overview]
Message-ID: <20090514162842.09182a39@hyperion.delvare> (raw)
In-Reply-To: <4A0C28AB.9030802@compulab.co.il>

Hi Mike,

On Thu, 14 May 2009 17:20:27 +0300, Mike Rapoport wrote:
> I've addressed all the comments Jean had, and I hopefully haven't broke any I2C
> bits this time, so I dare to add Jean's Ack.
> 
> This driver supports Synaptics I2C touchpad controller on eXeda
> mobile device.

I keep seeing new bugs, sorry for missing this one during the previous
round:

> +static int __devinit synaptics_i2c_probe(struct i2c_client *client,
> +			       const struct i2c_device_id *dev_id)
> +{
> +	int ret;
> +	struct synaptics_i2c *touch;
> +
> +	touch = synaptics_i2c_touch_create(client);
> +	if (!touch)
> +		return -ENOMEM;
> +
> +	i2c_set_clientdata(client, touch);
> +
> +	ret = synaptics_i2c_reset_config(client);
> +	if (ret)
> +		goto err_mem_free;
> +
> +	if (client->irq < 1)
> +		polling_req = 1;
> +
> +	touch->input = input_allocate_device();
> +	if (!touch->input)
> +		goto err_mem_free;

You jump without setting err to -ENOMEM. err is 0 at this point so you
will return success while the probe failed. Bad...

> +
> +	synaptics_i2c_set_input_params(touch);
> +
> +	if (!polling_req)
> +		dev_info(&touch->client->dev,
> +			  "IRQ will be used: %d\n", touch->client->irq);
> +	else
> +		dev_info(&touch->client->dev,
> +			  "Using polling at rate: %d times/sec\n", scan_rate);
> +
> +	/* Register the device in input subsystem */
> +	ret = input_register_device(touch->input);
> +	if (ret) {
> +		dev_err(&client->dev,
> +			 "Input device register failed: %d\n", ret);
> +		goto err_input_free;
> +	}
> +	return 0;
> +
> +err_input_free:
> +	input_free_device(touch->input);
> +err_mem_free:
> +	i2c_set_clientdata(client, NULL);
> +	kfree(touch);
> +
> +	return ret;
> +}

Also note that:

> +static const struct i2c_device_id synaptics_i2c_id_table[] = {
> +	{ "synaptics_i2c", 0 },
> +	{ },
> +};
> +MODULE_DEVICE_TABLE(i2c, synaptics_i2c_id_table);

The "_i2c" in the device name is kind of redundant, as you are already
in the namespace of i2c devices. But that's up to you, it's only a
minor aesthetic issue.

All the rest looks OK.

-- 
Jean Delvare

  reply	other threads:[~2009-05-14 14:28 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13 14:30 [PATCH] input: add synaptics_i2c driver Mike Rapoport
2009-05-14  2:50 ` Dmitry Torokhov
2009-05-14  7:28   ` Jean Delvare
2009-05-14  9:04     ` Mike Rapoport
2009-05-14 11:00       ` Jean Delvare
2009-05-14 11:29         ` Mike Rapoport
2009-05-14 14:20   ` Mike Rapoport
2009-05-14 14:28     ` Jean Delvare [this message]
2009-05-14 15:01       ` Mike Rapoport
2009-05-14 15:03     ` Dmitry Torokhov

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=20090514162842.09182a39@hyperion.delvare \
    --to=khali@linux-fr.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=grinberg@compulab.co.il \
    --cc=linux-input@vger.kernel.org \
    --cc=mike@compulab.co.il \
    /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;
as well as URLs for NNTP newsgroup(s).