All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karol Lewandowski <k.lewandowsk-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
To: Jean-Christophe PLAGNIOL-VILLARD
	<plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH 1/5 v3] i2c/gpio: add DT support
Date: Thu, 08 Mar 2012 11:52:00 +0100	[thread overview]
Message-ID: <4F588F50.7060906@samsung.com> (raw)
In-Reply-To: <1331196635-27203-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>

On 08.03.2012 09:50, Jean-Christophe PLAGNIOL-VILLARD wrote:

> +static int __devinit of_i2c_gpio_probe(struct device_node *np,
> +			     struct i2c_gpio_platform_data *pdata)
> +{
> +	u32 reg;
> +
> +	if (of_gpio_count(np) < 2)
> +		return -ENODEV;
> +
> +	pdata->sda_pin = of_get_gpio(np, 0);
> +	pdata->scl_pin = of_get_gpio(np, 1);
> +
> +	if (pdata->sda_pin < 0 || pdata->scl_pin < 0) {
> +		pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n",
> +		       np->full_name, pdata->sda_pin, pdata->scl_pin);
> +		return -ENODEV;
> +	}
> +
> +	of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay);
> +



> +	if (of_property_read_u32(np, "i2c-gpio,timeout-ms", &reg))
> +		pdata->timeout = msecs_to_jiffies(reg);


I've already said (two times!) that of_property_read_u32() returns
nonzero (negative) error code on _error_.

Don't you see obvious error in above code fragment?

You assign to pdata->timeout on _error_.

WARNING: multiple messages have this Message-ID (diff)
From: k.lewandowsk@samsung.com (Karol Lewandowski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/5 v3] i2c/gpio: add DT support
Date: Thu, 08 Mar 2012 11:52:00 +0100	[thread overview]
Message-ID: <4F588F50.7060906@samsung.com> (raw)
In-Reply-To: <1331196635-27203-1-git-send-email-plagnioj@jcrosoft.com>

On 08.03.2012 09:50, Jean-Christophe PLAGNIOL-VILLARD wrote:

> +static int __devinit of_i2c_gpio_probe(struct device_node *np,
> +			     struct i2c_gpio_platform_data *pdata)
> +{
> +	u32 reg;
> +
> +	if (of_gpio_count(np) < 2)
> +		return -ENODEV;
> +
> +	pdata->sda_pin = of_get_gpio(np, 0);
> +	pdata->scl_pin = of_get_gpio(np, 1);
> +
> +	if (pdata->sda_pin < 0 || pdata->scl_pin < 0) {
> +		pr_err("%s: invalid GPIO pins, sda=%d/scl=%d\n",
> +		       np->full_name, pdata->sda_pin, pdata->scl_pin);
> +		return -ENODEV;
> +	}
> +
> +	of_property_read_u32(np, "i2c-gpio,delay-us", &pdata->udelay);
> +



> +	if (of_property_read_u32(np, "i2c-gpio,timeout-ms", &reg))
> +		pdata->timeout = msecs_to_jiffies(reg);


I've already said (two times!) that of_property_read_u32() returns
nonzero (negative) error code on _error_.

Don't you see obvious error in above code fragment?

You assign to pdata->timeout on _error_.

  parent reply	other threads:[~2012-03-08 10:52 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-08  8:50 [PATCH 1/5 v3] i2c/gpio: add DT support Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50 ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50 ` [PATCH 2/5 v3] ARM: at91: sam9g20 add i2c " Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 17:08   ` Rob Herring
2012-03-08 17:08     ` Rob Herring
2012-03-09  9:53     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09  9:53       ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09 13:59       ` Rob Herring
2012-03-09 13:59         ` Rob Herring
2012-03-13  7:08         ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13  7:08           ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09  5:26   ` Grant Likely
2012-03-09  5:26     ` Grant Likely
2012-03-09  9:55     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-09  9:55       ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50 ` [PATCH 3/5 v3] ARM: at91: usb_a9g20 add DT i2c support Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50 ` [PATCH 4/5 v3] ARM: at91: sam9g45 add i2c DT support Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50 ` [PATCH 5/5 v3] ARM: at91: sam9x5 " Jean-Christophe PLAGNIOL-VILLARD
2012-03-08  8:50   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 17:12   ` Rob Herring
2012-03-08 17:12     ` Rob Herring
2012-03-08 17:52     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 17:52       ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 20:36       ` Rob Herring
2012-03-08 20:36         ` Rob Herring
     [not found] ` <1331196635-27203-1-git-send-email-plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.org>
2012-03-08 10:52   ` Karol Lewandowski [this message]
2012-03-08 10:52     ` [PATCH 1/5 v3] i2c/gpio: add " Karol Lewandowski
     [not found]     ` <4F588F50.7060906-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2012-03-08 16:53       ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 16:53         ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-08 17:16   ` Rob Herring
2012-03-08 17:16     ` Rob Herring
2012-03-13  7:07   ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13  7:07     ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13  7:37   ` Wolfram Sang
2012-03-13  7:37     ` Wolfram Sang
     [not found]     ` <20120313073748.GA7746-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org>
2012-03-13  9:11       ` Jean-Christophe PLAGNIOL-VILLARD
2012-03-13  9:11         ` Jean-Christophe PLAGNIOL-VILLARD
     [not found]         ` <20120313091104.GE18320-RQcB7r2h9QmfDR2tN2SG5Ni2O/JbrIOy@public.gmane.org>
2012-03-13 10:22           ` Wolfram Sang
2012-03-13 10:22             ` Wolfram Sang

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=4F588F50.7060906@samsung.com \
    --to=k.lewandowsk-sze3o3uu22jbdgjk7y7tuq@public.gmane.org \
    --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=plagnioj-sclMFOaUSTBWk0Htik3J/w@public.gmane.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 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.