Skip to contentSkip to conversation

gpio-74x164: Fix buffer allocation size

PATCH In review Roland Stigge 2 participants 2 messages Oct 16, 2012 GPIO

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gpio-74x164: Fix buffer allocation size

The new registers handling in the gpio-74x164 driver allocates chip->registers
* 8 bytes where only one byte per register is necessary. This patch fixes this.

---
 drivers/gpio/gpio-74x164.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-74x164.c +1 -1
@@ -153,7 +153,7 @@ static int __devinit gen_74x164_probe(st
 	}
 
 	chip->gpio_chip.ngpio = GEN_74X164_NUMBER_GPIOS * chip->registers;
-	chip->buffer = devm_kzalloc(&spi->dev, chip->gpio_chip.ngpio, GFP_KERNEL);
+	chip->buffer = devm_kzalloc(&spi->dev, chip->registers, GFP_KERNEL);
 	if (!chip->buffer) {
 		ret = -ENOMEM;
 		goto exit_destroy;
#1 lore raw
Quoted 4 lines · Roland Stigge

The new registers handling in the gpio-74x164 driver allocates chip->registers
* 8 bytes where only one byte per register is necessary. This patch fixes this.

Patch applied to my fixes branch unless someone shouts...

Yours,
Linus Walleij