Merge tag 'iommu-updates-v5.4' of git://git.kernel.org/pub/scm/linux/kernel/git/joro...
[sfrench/cifs-2.6.git] / drivers / gpio / gpio-ftgpio010.c
index 250e71f3e68825833bca14c5b04116618be997a6..fbddb166242874d3669ed83ba6cddc2dec225be8 100644 (file)
@@ -290,16 +290,14 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
        girq->num_parents = 1;
        girq->parents = devm_kcalloc(dev, 1, sizeof(*girq->parents),
                                     GFP_KERNEL);
-       if (!girq->parents)
-               return -ENOMEM;
+       if (!girq->parents) {
+               ret = -ENOMEM;
+               goto dis_clk;
+       }
        girq->default_type = IRQ_TYPE_NONE;
        girq->handler = handle_bad_irq;
        girq->parents[0] = irq;
 
-       ret = devm_gpiochip_add_data(dev, &g->gc, g);
-       if (ret)
-               goto dis_clk;
-
        /* Disable, unmask and clear all interrupts */
        writel(0x0, g->base + GPIO_INT_EN);
        writel(0x0, g->base + GPIO_INT_MASK);
@@ -308,6 +306,10 @@ static int ftgpio_gpio_probe(struct platform_device *pdev)
        /* Clear any use of debounce */
        writel(0x0, g->base + GPIO_DEBOUNCE_EN);
 
+       ret = devm_gpiochip_add_data(dev, &g->gc, g);
+       if (ret)
+               goto dis_clk;
+
        platform_set_drvdata(pdev, g);
        dev_info(dev, "FTGPIO010 @%p registered\n", g->base);