Skip to content

Commit c05235d

Browse files
committed
Merge tag 'gpio-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio
Pull GPIO fixes from Linus Walleij: - Probe errorpath fix for the Altera - irqchip ofnode pointer added to the DaVinci driver - controller instance number correction for DaVinci * tag 'gpio-v4.5-2' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: gpio: davinci: Fix the number of controllers allocated gpio: davinci: Add the missing of-node pointer gpio: gpio-altera: Remove gpiochip on probe failure.
2 parents da2f912 + 6ec9249 commit c05235d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

drivers/gpio/gpio-altera.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,8 +312,8 @@ static int altera_gpio_probe(struct platform_device *pdev)
312312
handle_simple_irq, IRQ_TYPE_NONE);
313313

314314
if (ret) {
315-
dev_info(&pdev->dev, "could not add irqchip\n");
316-
return ret;
315+
dev_err(&pdev->dev, "could not add irqchip\n");
316+
goto teardown;
317317
}
318318

319319
gpiochip_set_chained_irqchip(&altera_gc->mmchip.gc,
@@ -326,6 +326,7 @@ static int altera_gpio_probe(struct platform_device *pdev)
326326
skip_irq:
327327
return 0;
328328
teardown:
329+
of_mm_gpiochip_remove(&altera_gc->mmchip);
329330
pr_err("%s: registration failed with status %d\n",
330331
node->full_name, ret);
331332

drivers/gpio/gpio-davinci.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ static int davinci_gpio_of_xlate(struct gpio_chip *gc,
195195
static int davinci_gpio_probe(struct platform_device *pdev)
196196
{
197197
int i, base;
198-
unsigned ngpio;
198+
unsigned ngpio, nbank;
199199
struct davinci_gpio_controller *chips;
200200
struct davinci_gpio_platform_data *pdata;
201201
struct davinci_gpio_regs __iomem *regs;
@@ -224,8 +224,9 @@ static int davinci_gpio_probe(struct platform_device *pdev)
224224
if (WARN_ON(ARCH_NR_GPIOS < ngpio))
225225
ngpio = ARCH_NR_GPIOS;
226226

227+
nbank = DIV_ROUND_UP(ngpio, 32);
227228
chips = devm_kzalloc(dev,
228-
ngpio * sizeof(struct davinci_gpio_controller),
229+
nbank * sizeof(struct davinci_gpio_controller),
229230
GFP_KERNEL);
230231
if (!chips)
231232
return -ENOMEM;
@@ -511,7 +512,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
511512
return irq;
512513
}
513514

514-
irq_domain = irq_domain_add_legacy(NULL, ngpio, irq, 0,
515+
irq_domain = irq_domain_add_legacy(dev->of_node, ngpio, irq, 0,
515516
&davinci_gpio_irq_ops,
516517
chips);
517518
if (!irq_domain) {

0 commit comments

Comments
 (0)