mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dirk Eibach <eibach@gdsys.de>
To: linux-kernel@vger.kernel.org
Cc: error27@gmail.com, Dirk Eibach <eibach@gdsys.de>
Subject: [PATCH v2] gpio: Fix wrong pointer type in pca953x
Date: Tue, 22 Feb 2011 14:28:04 +0100	[thread overview]
Message-ID: <1298381284-23317-1-git-send-email-eibach@gdsys.de> (raw)
In-Reply-To: <20110222123601.GA1966@bicker>

pca953x_get_alt_pdata() uses uint16_t* as result type for
of_get_property(), but numeric of values are u32.

Checking for negative values is bogus because of-property
values are unsigned by definition.

Signed-off-by: Dirk Eibach <eibach@gdsys.de>
---
Changes since v1:
- removed bogus check for negative property values

 drivers/gpio/pca953x.c |   11 +++--------
 1 files changed, 3 insertions(+), 8 deletions(-)

diff --git a/drivers/gpio/pca953x.c b/drivers/gpio/pca953x.c
index a261972..8acbfe9 100644
--- a/drivers/gpio/pca953x.c
+++ b/drivers/gpio/pca953x.c
@@ -448,7 +448,7 @@ pca953x_get_alt_pdata(struct i2c_client *client)
 {
 	struct pca953x_platform_data *pdata;
 	struct device_node *node;
-	const uint16_t *val;
+	const u32 *val;
 
 	node = client->dev.of_node;
 	if (node == NULL)
@@ -462,13 +462,8 @@ pca953x_get_alt_pdata(struct i2c_client *client)
 
 	pdata->gpio_base = -1;
 	val = of_get_property(node, "linux,gpio-base", NULL);
-	if (val) {
-		if (*val < 0)
-			dev_warn(&client->dev,
-				 "invalid gpio-base in device tree\n");
-		else
-			pdata->gpio_base = *val;
-	}
+	if (val)
+		pdata->gpio_base = *val;
 
 	val = of_get_property(node, "polarity", NULL);
 	if (val)
-- 
1.5.6.5


  parent reply	other threads:[~2011-02-22 13:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-22  8:56 [PATCH] " Dirk Eibach
2011-02-22 12:36 ` Dan Carpenter
2011-02-22 12:52   ` Eibach, Dirk
2011-02-22 13:28   ` Dirk Eibach [this message]
2011-02-24  9:20   ` [PATCH v3] " Dirk Eibach
2011-02-24 15:56     ` Grant Likely

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=1298381284-23317-1-git-send-email-eibach@gdsys.de \
    --to=eibach@gdsys.de \
    --cc=error27@gmail.com \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®