All of lore.kernel.org
 help / color / mirror / Atom feed
* re: pinctrl: add TB10x pin control driver
@ 2014-04-02 11:13 Dan Carpenter
  2014-04-11 14:46   ` Christian Ruppert
  0 siblings, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2014-04-02 11:13 UTC (permalink / raw)
  To: christian.ruppert-ux6zf3SgZrrQT0dZR+AlfA
  Cc: devicetree-u79uwXL29TY76Z2rM5mHXA, Linus Walleij

Hello Christian Ruppert,

The patch 5aad0db1c1eb: "pinctrl: add TB10x pin control driver" from
Oct 15, 2013, leads to the following static checker warning:

	drivers/pinctrl/pinctrl-tb10x.c:640 tb10x_gpio_request_enable()
	warn: unsigned 'port' is never less than zero.

drivers/pinctrl/pinctrl-tb10x.c
   624          /*
   625           * Figure out to which port the requested GPIO belongs and how to
   626           * configure that port.
   627           * This loop also checks for pin conflicts between GPIOs and other
   628           * functions.
   629           */
   630          for (i = 0; i < state->pinfuncgrpcnt; i++) {
   631                  const struct tb10x_pinfuncgrp *pfg = &state->pingroups[i];
   632                  unsigned int port = pfg->port;
   633                  unsigned int mode = pfg->mode;
   634                  int j;
   635  
   636                  /*
   637                   * Skip pin groups which are always mapped and don't need
   638                   * to be configured.
   639                   */
   640                  if (port < 0)
                            ^^^^^^^^

"pfg->port" is an int so probably "port" should be as well.

   641                          continue;
   642  
   643                  for (j = 0; j < pfg->pincnt; j++) {
   644                          if (pin == pfg->pins[j]) {
   645                                  if (pfg->isgpio) {

regards,
dan carpenter
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl/TB10x: Fix signedness bug
  2014-04-02 11:13 pinctrl: add TB10x pin control driver Dan Carpenter
@ 2014-04-11 14:46   ` Christian Ruppert
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ruppert @ 2014-04-11 14:46 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel; +Cc: Dan Carpenter, devicetree, Christian Ruppert

In the TB10x pin database, a port index of -1 is used to indicate
unmuxed GPIO pin groups. This bug fixes a 'cast to unsigned' bug of
this value.

Thanks to Dan Carpenter for highlighting this.

CC: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>
---
 drivers/pinctrl/pinctrl-tb10x.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-tb10x.c b/drivers/pinctrl/pinctrl-tb10x.c
index c5e0f69..26ca685 100644
--- a/drivers/pinctrl/pinctrl-tb10x.c
+++ b/drivers/pinctrl/pinctrl-tb10x.c
@@ -629,9 +629,8 @@ static int tb10x_gpio_request_enable(struct pinctrl_dev *pctl,
 	 */
 	for (i = 0; i < state->pinfuncgrpcnt; i++) {
 		const struct tb10x_pinfuncgrp *pfg = &state->pingroups[i];
-		unsigned int port = pfg->port;
 		unsigned int mode = pfg->mode;
-		int j;
+		int j, port = pfg->port;
 
 		/*
 		 * Skip pin groups which are always mapped and don't need
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] pinctrl/TB10x: Fix signedness bug
@ 2014-04-11 14:46   ` Christian Ruppert
  0 siblings, 0 replies; 4+ messages in thread
From: Christian Ruppert @ 2014-04-11 14:46 UTC (permalink / raw)
  To: Linus Walleij, linux-kernel-u79uwXL29TY76Z2rM5mHXA
  Cc: Dan Carpenter, devicetree-u79uwXL29TY76Z2rM5mHXA, Christian Ruppert

In the TB10x pin database, a port index of -1 is used to indicate
unmuxed GPIO pin groups. This bug fixes a 'cast to unsigned' bug of
this value.

Thanks to Dan Carpenter for highlighting this.

CC: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>
Signed-off-by: Christian Ruppert <christian.ruppert-ux6zf3SgZrrQT0dZR+AlfA@public.gmane.org>
---
 drivers/pinctrl/pinctrl-tb10x.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/pinctrl/pinctrl-tb10x.c b/drivers/pinctrl/pinctrl-tb10x.c
index c5e0f69..26ca685 100644
--- a/drivers/pinctrl/pinctrl-tb10x.c
+++ b/drivers/pinctrl/pinctrl-tb10x.c
@@ -629,9 +629,8 @@ static int tb10x_gpio_request_enable(struct pinctrl_dev *pctl,
 	 */
 	for (i = 0; i < state->pinfuncgrpcnt; i++) {
 		const struct tb10x_pinfuncgrp *pfg = &state->pingroups[i];
-		unsigned int port = pfg->port;
 		unsigned int mode = pfg->mode;
-		int j;
+		int j, port = pfg->port;
 
 		/*
 		 * Skip pin groups which are always mapped and don't need
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] pinctrl/TB10x: Fix signedness bug
  2014-04-11 14:46   ` Christian Ruppert
  (?)
@ 2014-04-22 12:55   ` Linus Walleij
  -1 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2014-04-22 12:55 UTC (permalink / raw)
  To: Christian Ruppert; +Cc: linux-kernel, Dan Carpenter, devicetree

On Fri, Apr 11, 2014 at 4:46 PM, Christian Ruppert
<christian.ruppert@abilis.com> wrote:

> In the TB10x pin database, a port index of -1 is used to indicate
> unmuxed GPIO pin groups. This bug fixes a 'cast to unsigned' bug of
> this value.
>
> Thanks to Dan Carpenter for highlighting this.
>
> CC: Dan Carpenter <dan.carpenter@oracle.com>
> Signed-off-by: Christian Ruppert <christian.ruppert@abilis.com>

Patch applied for fixes.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-22 12:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-04-02 11:13 pinctrl: add TB10x pin control driver Dan Carpenter
2014-04-11 14:46 ` [PATCH] pinctrl/TB10x: Fix signedness bug Christian Ruppert
2014-04-11 14:46   ` Christian Ruppert
2014-04-22 12:55   ` Linus Walleij

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.