summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRashmica Gupta <rashmica.g@gmail.com>2019-09-06 09:26:22 +0300
committerJoel Stanley <joel@jms.id.au>2019-09-10 20:29:57 +0300
commit4fc18278f05742ec77626fecee9f0401ed69392c (patch)
tree0bf755d295a7c6e8efafd3c6e6b0457e23ff0391
parent4aec70ac207512feedef6de4ae4472d6e8acfaf8 (diff)
downloadlinux-4fc18278f05742ec77626fecee9f0401ed69392c.tar.xz
gpio/aspeed: Fix incorrect number of banks
The current calculation for the number of GPIO banks is only correct if the number of GPIOs is a multiple of 32 (if there were 31 GPIOs we would currently say there are 0 banks, which is incorrect). OpenBMC-Staging-Count: 1 Fixes: 361b79119a4b7 ('gpio: Add Aspeed driver') Signed-off-by: Rashmica Gupta <rashmica.g@gmail.com> Reviewed-by: Andrew Jeffery <andrew@aj.id.au> Reviewed-by: Joel Stanley <joel@jms.d.au> Signed-off-by: Joel Stanley <joel@jms.id.au>
-rw-r--r--drivers/gpio/gpio-aspeed.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpio/gpio-aspeed.c b/drivers/gpio/gpio-aspeed.c
index 9defe25d4721..b83e23aecd18 100644
--- a/drivers/gpio/gpio-aspeed.c
+++ b/drivers/gpio/gpio-aspeed.c
@@ -1165,7 +1165,7 @@ static int __init aspeed_gpio_probe(struct platform_device *pdev)
gpio->chip.base = -1;
/* Allocate a cache of the output registers */
- banks = gpio->config->nr_gpios >> 5;
+ banks = DIV_ROUND_UP(gpio->config->nr_gpios, 32);
gpio->dcache = devm_kcalloc(&pdev->dev,
banks, sizeof(u32), GFP_KERNEL);
if (!gpio->dcache)