Skip to contentSkip to conversation

pinctrl: abx500: fix bitwise AND test

PATCH In review Dan Carpenter 2 participants 2 messages Aug 26, 2013 – Aug 28, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pinctrl: abx500: fix bitwise AND test

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.

---
I can't compile this.

drivers/pinctrl/pinctrl-abx500.c +3 -3
index 1d3f988..9afae3f 100644
@@ -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;
 
#1 lore raw
Quoted 6 lines · Dan Carpenter

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.

---
I can't compile this.

Works for me so patch applied.

Patrice: looks all right?

Yours,
Linus Walleij