public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] pinctrl: abx500: fix bitwise AND test
@ 2013-08-26 16:03 Dan Carpenter
  2013-08-28 12:32 ` Linus Walleij
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2013-08-26 16:03 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Grant Likely, Rob Herring, linux-kernel, devicetree,
	kernel-janitors

The intent here was to test if the bit was set or not but there is a
logical vs bitwise AND typo so it is true if any bits are set.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
I can't compile this.

diff --git a/drivers/pinctrl/pinctrl-abx500.c b/drivers/pinctrl/pinctrl-abx500.c
index 1d3f988..9afae3f 100644
--- a/drivers/pinctrl/pinctrl-abx500.c
+++ b/drivers/pinctrl/pinctrl-abx500.c
@@ -426,7 +426,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
 				ret = abx500_gpio_set_bits(chip,
 					AB8500_GPIO_ALTFUN_REG,
 					af.alt_bit2,
-					!!(af.alta_val && BIT(1)));
+					!!(af.alta_val & BIT(1)));
 		} else
 			ret = abx500_gpio_set_bits(chip, AB8500_GPIO_SEL1_REG,
 					offset, 1);
@@ -447,7 +447,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
 			ret = abx500_gpio_set_bits(chip,
 					AB8500_GPIO_ALTFUN_REG,
 					af.alt_bit2,
-					!!(af.altb_val && BIT(1)));
+					!!(af.altb_val & BIT(1)));
 		break;
 
 	case ABX500_ALT_C:
@@ -457,7 +457,7 @@ static int abx500_set_mode(struct pinctrl_dev *pctldev, struct gpio_chip *chip,
 			goto out;
 
 		ret = abx500_gpio_set_bits(chip, AB8500_GPIO_ALTFUN_REG,
-				af.alt_bit2, !!(af.altc_val && BIT(0)));
+				af.alt_bit2, !!(af.altc_val & BIT(0)));
 		if (ret < 0)
 			goto out;
 

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

* Re: [patch] pinctrl: abx500: fix bitwise AND test
  2013-08-26 16:03 [patch] pinctrl: abx500: fix bitwise AND test Dan Carpenter
@ 2013-08-28 12:32 ` Linus Walleij
  0 siblings, 0 replies; 2+ messages in thread
From: Linus Walleij @ 2013-08-28 12:32 UTC (permalink / raw)
  To: Dan Carpenter, Patrice CHOTARD
  Cc: Grant Likely, Rob Herring, linux-kernel@vger.kernel.org,
	devicetree@vger.kernel.org, kernel-janitors

On Mon, Aug 26, 2013 at 6:03 PM, Dan Carpenter <dan.carpenter@oracle.com> wrote:

> The intent here was to test if the bit was set or not but there is a
> logical vs bitwise AND typo so it is true if any bits are set.
>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
> I can't compile this.

Works for me so patch applied.

Patrice: looks all right?

Yours,
Linus Walleij

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

end of thread, other threads:[~2013-08-28 12:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-26 16:03 [patch] pinctrl: abx500: fix bitwise AND test Dan Carpenter
2013-08-28 12:32 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox