aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--arch/arm/common/scoop.c10
-rw-r--r--arch/mips/txx9/generic/setup.c4
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c3
-rw-r--r--arch/sh/boards/mach-x3proto/gpio.c6
-rw-r--r--drivers/bcma/driver_gpio.c3
-rw-r--r--drivers/gpio/gpio-zynq.c3
-rw-r--r--drivers/hid/hid-cp2112.c6
-rw-r--r--drivers/input/keyboard/adp5588-keys.c4
-rw-r--r--drivers/input/keyboard/adp5589-keys.c4
-rw-r--r--drivers/input/touchscreen/ad7879.c10
-rw-r--r--drivers/leds/leds-pca9532.c10
-rw-r--r--drivers/leds/leds-tca6507.c7
-rw-r--r--drivers/media/dvb-frontends/cxd2820r_core.c10
-rw-r--r--drivers/mfd/asic3.c3
-rw-r--r--drivers/mfd/htc-i2cpld.c8
-rw-r--r--drivers/mfd/sm501.c17
-rw-r--r--drivers/mfd/tc6393xb.c13
-rw-r--r--drivers/mfd/ucb1x00-core.c8
-rw-r--r--drivers/platform/x86/intel_pmic_gpio.c3
-rw-r--r--drivers/ssb/driver_gpio.c3
-rw-r--r--drivers/staging/vme/devices/vme_pio2_gpio.c4
-rw-r--r--drivers/tty/serial/max310x.c10
-rw-r--r--drivers/video/fbdev/via/via-gpio.c10
-rw-r--r--sound/soc/codecs/wm5100.c5
-rw-r--r--sound/soc/codecs/wm8903.c6
-rw-r--r--sound/soc/codecs/wm8962.c5
-rw-r--r--sound/soc/codecs/wm8996.c6
27 files changed, 52 insertions, 129 deletions
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a20fa80776d3..45f4c21e393c 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -243,18 +243,12 @@ err_ioremap:
243static int scoop_remove(struct platform_device *pdev) 243static int scoop_remove(struct platform_device *pdev)
244{ 244{
245 struct scoop_dev *sdev = platform_get_drvdata(pdev); 245 struct scoop_dev *sdev = platform_get_drvdata(pdev);
246 int ret;
247 246
248 if (!sdev) 247 if (!sdev)
249 return -EINVAL; 248 return -EINVAL;
250 249
251 if (sdev->gpio.base != -1) { 250 if (sdev->gpio.base != -1)
252 ret = gpiochip_remove(&sdev->gpio); 251 gpiochip_remove(&sdev->gpio);
253 if (ret) {
254 dev_err(&pdev->dev, "Can't remove gpio chip: %d\n", ret);
255 return ret;
256 }
257 }
258 252
259 platform_set_drvdata(pdev, NULL); 253 platform_set_drvdata(pdev, NULL);
260 iounmap(sdev->base); 254 iounmap(sdev->base);
diff --git a/arch/mips/txx9/generic/setup.c b/arch/mips/txx9/generic/setup.c
index 9ff200ae1c9a..2791b8641df6 100644
--- a/arch/mips/txx9/generic/setup.c
+++ b/arch/mips/txx9/generic/setup.c
@@ -789,11 +789,11 @@ void __init txx9_iocled_init(unsigned long baseaddr,
789 if (platform_device_add(pdev)) 789 if (platform_device_add(pdev))
790 goto out_pdev; 790 goto out_pdev;
791 return; 791 return;
792
792out_pdev: 793out_pdev:
793 platform_device_put(pdev); 794 platform_device_put(pdev);
794out_gpio: 795out_gpio:
795 if (gpiochip_remove(&iocled->chip)) 796 gpiochip_remove(&iocled->chip);
796 return;
797out_unmap: 797out_unmap:
798 iounmap(iocled->mmioaddr); 798 iounmap(iocled->mmioaddr);
799out_free: 799out_free:
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index e238b6a55b15..73997027b085 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -141,7 +141,8 @@ static int mcu_gpiochip_add(struct mcu *mcu)
141 141
142static int mcu_gpiochip_remove(struct mcu *mcu) 142static int mcu_gpiochip_remove(struct mcu *mcu)
143{ 143{
144 return gpiochip_remove(&mcu->gc); 144 gpiochip_remove(&mcu->gc);
145 return 0;
145} 146}
146 147
147static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id) 148static int mcu_probe(struct i2c_client *client, const struct i2c_device_id *id)
diff --git a/arch/sh/boards/mach-x3proto/gpio.c b/arch/sh/boards/mach-x3proto/gpio.c
index 3ea65e9b56e8..f035a7ac6456 100644
--- a/arch/sh/boards/mach-x3proto/gpio.c
+++ b/arch/sh/boards/mach-x3proto/gpio.c
@@ -128,10 +128,8 @@ int __init x3proto_gpio_setup(void)
128 return 0; 128 return 0;
129 129
130err_irq: 130err_irq:
131 ret = gpiochip_remove(&x3proto_gpio_chip); 131 gpiochip_remove(&x3proto_gpio_chip);
132 if (unlikely(ret)) 132 ret = 0;
133 pr_err("Failed deregistering GPIO\n");
134
135err_gpio: 133err_gpio:
136 synchronize_irq(ilsel); 134 synchronize_irq(ilsel);
137 135
diff --git a/drivers/bcma/driver_gpio.c b/drivers/bcma/driver_gpio.c
index aec9f850b4a8..710fa62dd5ae 100644
--- a/drivers/bcma/driver_gpio.c
+++ b/drivers/bcma/driver_gpio.c
@@ -251,5 +251,6 @@ int bcma_gpio_init(struct bcma_drv_cc *cc)
251int bcma_gpio_unregister(struct bcma_drv_cc *cc) 251int bcma_gpio_unregister(struct bcma_drv_cc *cc)
252{ 252{
253 bcma_gpio_irq_domain_exit(cc); 253 bcma_gpio_irq_domain_exit(cc);
254 return gpiochip_remove(&cc->gpio); 254 gpiochip_remove(&cc->gpio);
255 return 0;
255} 256}
diff --git a/drivers/gpio/gpio-zynq.c b/drivers/gpio/gpio-zynq.c
index 1e6f19a07454..5dfbced24815 100644
--- a/drivers/gpio/gpio-zynq.c
+++ b/drivers/gpio/gpio-zynq.c
@@ -671,8 +671,7 @@ static int zynq_gpio_probe(struct platform_device *pdev)
671 return 0; 671 return 0;
672 672
673err_rm_gpiochip: 673err_rm_gpiochip:
674 if (gpiochip_remove(chip)) 674 gpiochip_remove(chip);
675 dev_err(&pdev->dev, "Failed to remove gpio chip\n");
676err_disable_clk: 675err_disable_clk:
677 clk_disable_unprepare(gpio->clk); 676 clk_disable_unprepare(gpio->clk);
678 677
diff --git a/drivers/hid/hid-cp2112.c b/drivers/hid/hid-cp2112.c
index a822db5a8338..3318de690e00 100644
--- a/drivers/hid/hid-cp2112.c
+++ b/drivers/hid/hid-cp2112.c
@@ -1069,8 +1069,7 @@ static int cp2112_probe(struct hid_device *hdev, const struct hid_device_id *id)
1069 return ret; 1069 return ret;
1070 1070
1071err_gpiochip_remove: 1071err_gpiochip_remove:
1072 if (gpiochip_remove(&dev->gc) < 0) 1072 gpiochip_remove(&dev->gc);
1073 hid_err(hdev, "error removing gpio chip\n");
1074err_free_i2c: 1073err_free_i2c:
1075 i2c_del_adapter(&dev->adap); 1074 i2c_del_adapter(&dev->adap);
1076err_free_dev: 1075err_free_dev:
@@ -1089,8 +1088,7 @@ static void cp2112_remove(struct hid_device *hdev)
1089 struct cp2112_device *dev = hid_get_drvdata(hdev); 1088 struct cp2112_device *dev = hid_get_drvdata(hdev);
1090 1089
1091 sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group); 1090 sysfs_remove_group(&hdev->dev.kobj, &cp2112_attr_group);
1092 if (gpiochip_remove(&dev->gc)) 1091 gpiochip_remove(&dev->gc);
1093 hid_err(hdev, "unable to remove gpio chip\n");
1094 i2c_del_adapter(&dev->adap); 1092 i2c_del_adapter(&dev->adap);
1095 /* i2c_del_adapter has finished removing all i2c devices from our 1093 /* i2c_del_adapter has finished removing all i2c devices from our
1096 * adapter. Well behaved devices should no longer call our cp2112_xfer 1094 * adapter. Well behaved devices should no longer call our cp2112_xfer
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 5ef7fcf0e250..b97ed443e0a4 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -251,9 +251,7 @@ static void adp5588_gpio_remove(struct adp5588_kpad *kpad)
251 dev_warn(dev, "teardown failed %d\n", error); 251 dev_warn(dev, "teardown failed %d\n", error);
252 } 252 }
253 253
254 error = gpiochip_remove(&kpad->gc); 254 gpiochip_remove(&kpad->gc);
255 if (error)
256 dev_warn(dev, "gpiochip_remove failed %d\n", error);
257} 255}
258#else 256#else
259static inline int adp5588_gpio_add(struct adp5588_kpad *kpad) 257static inline int adp5588_gpio_add(struct adp5588_kpad *kpad)
diff --git a/drivers/input/keyboard/adp5589-keys.c b/drivers/input/keyboard/adp5589-keys.c
index 6329549bf6ad..a45267729dfc 100644
--- a/drivers/input/keyboard/adp5589-keys.c
+++ b/drivers/input/keyboard/adp5589-keys.c
@@ -567,9 +567,7 @@ static void adp5589_gpio_remove(struct adp5589_kpad *kpad)
567 dev_warn(dev, "teardown failed %d\n", error); 567 dev_warn(dev, "teardown failed %d\n", error);
568 } 568 }
569 569
570 error = gpiochip_remove(&kpad->gc); 570 gpiochip_remove(&kpad->gc);
571 if (error)
572 dev_warn(dev, "gpiochip_remove failed %d\n", error);
573} 571}
574#else 572#else
575static inline int adp5589_gpio_add(struct adp5589_kpad *kpad) 573static inline int adp5589_gpio_add(struct adp5589_kpad *kpad)
diff --git a/drivers/input/touchscreen/ad7879.c b/drivers/input/touchscreen/ad7879.c
index fce590677b7b..1eb9d3c20886 100644
--- a/drivers/input/touchscreen/ad7879.c
+++ b/drivers/input/touchscreen/ad7879.c
@@ -470,14 +470,10 @@ static int ad7879_gpio_add(struct ad7879 *ts,
470static void ad7879_gpio_remove(struct ad7879 *ts) 470static void ad7879_gpio_remove(struct ad7879 *ts)
471{ 471{
472 const struct ad7879_platform_data *pdata = dev_get_platdata(ts->dev); 472 const struct ad7879_platform_data *pdata = dev_get_platdata(ts->dev);
473 int ret;
474 473
475 if (pdata->gpio_export) { 474 if (pdata->gpio_export)
476 ret = gpiochip_remove(&ts->gc); 475 gpiochip_remove(&ts->gc);
477 if (ret) 476
478 dev_err(ts->dev, "failed to remove gpio %d\n",
479 ts->gc.base);
480 }
481} 477}
482#else 478#else
483static inline int ad7879_gpio_add(struct ad7879 *ts, 479static inline int ad7879_gpio_add(struct ad7879 *ts,
diff --git a/drivers/leds/leds-pca9532.c b/drivers/leds/leds-pca9532.c
index 4a0e786b7832..5a6363d161a2 100644
--- a/drivers/leds/leds-pca9532.c
+++ b/drivers/leds/leds-pca9532.c
@@ -319,14 +319,8 @@ static int pca9532_destroy_devices(struct pca9532_data *data, int n_devs)
319 } 319 }
320 320
321#ifdef CONFIG_LEDS_PCA9532_GPIO 321#ifdef CONFIG_LEDS_PCA9532_GPIO
322 if (data->gpio.dev) { 322 if (data->gpio.dev)
323 int err = gpiochip_remove(&data->gpio); 323 gpiochip_remove(&data->gpio);
324 if (err) {
325 dev_err(&data->client->dev, "%s failed, %d\n",
326 "gpiochip_remove()", err);
327 return err;
328 }
329 }
330#endif 324#endif
331 325
332 return 0; 326 return 0;
diff --git a/drivers/leds/leds-tca6507.c b/drivers/leds/leds-tca6507.c
index 3d9e267a56c4..20fa8e77f186 100644
--- a/drivers/leds/leds-tca6507.c
+++ b/drivers/leds/leds-tca6507.c
@@ -667,11 +667,8 @@ static int tca6507_probe_gpios(struct i2c_client *client,
667 667
668static void tca6507_remove_gpio(struct tca6507_chip *tca) 668static void tca6507_remove_gpio(struct tca6507_chip *tca)
669{ 669{
670 if (tca->gpio.ngpio) { 670 if (tca->gpio.ngpio)
671 int err = gpiochip_remove(&tca->gpio); 671 gpiochip_remove(&tca->gpio);
672 dev_err(&tca->client->dev, "%s failed, %d\n",
673 "gpiochip_remove()", err);
674 }
675} 672}
676#else /* CONFIG_GPIOLIB */ 673#else /* CONFIG_GPIOLIB */
677static int tca6507_probe_gpios(struct i2c_client *client, 674static int tca6507_probe_gpios(struct i2c_client *client,
diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c
index 03930d5e9fea..51ef89312615 100644
--- a/drivers/media/dvb-frontends/cxd2820r_core.c
+++ b/drivers/media/dvb-frontends/cxd2820r_core.c
@@ -584,18 +584,14 @@ static int cxd2820r_get_frontend_algo(struct dvb_frontend *fe)
584static void cxd2820r_release(struct dvb_frontend *fe) 584static void cxd2820r_release(struct dvb_frontend *fe)
585{ 585{
586 struct cxd2820r_priv *priv = fe->demodulator_priv; 586 struct cxd2820r_priv *priv = fe->demodulator_priv;
587 int uninitialized_var(ret); /* silence compiler warning */
588 587
589 dev_dbg(&priv->i2c->dev, "%s\n", __func__); 588 dev_dbg(&priv->i2c->dev, "%s\n", __func__);
590 589
591#ifdef CONFIG_GPIOLIB 590#ifdef CONFIG_GPIOLIB
592 /* remove GPIOs */ 591 /* remove GPIOs */
593 if (priv->gpio_chip.label) { 592 if (priv->gpio_chip.label)
594 ret = gpiochip_remove(&priv->gpio_chip); 593 gpiochip_remove(&priv->gpio_chip);
595 if (ret) 594
596 dev_err(&priv->i2c->dev, "%s: gpiochip_remove() " \
597 "failed=%d\n", KBUILD_MODNAME, ret);
598 }
599#endif 595#endif
600 kfree(priv); 596 kfree(priv);
601 return; 597 return;
diff --git a/drivers/mfd/asic3.c b/drivers/mfd/asic3.c
index 9fc4186d4132..977bd3a3eed0 100644
--- a/drivers/mfd/asic3.c
+++ b/drivers/mfd/asic3.c
@@ -605,7 +605,8 @@ static int asic3_gpio_remove(struct platform_device *pdev)
605{ 605{
606 struct asic3 *asic = platform_get_drvdata(pdev); 606 struct asic3 *asic = platform_get_drvdata(pdev);
607 607
608 return gpiochip_remove(&asic->gpio); 608 gpiochip_remove(&asic->gpio);
609 return 0;
609} 610}
610 611
611static void asic3_clk_enable(struct asic3 *asic, struct asic3_clk *clk) 612static void asic3_clk_enable(struct asic3 *asic, struct asic3_clk *clk)
diff --git a/drivers/mfd/htc-i2cpld.c b/drivers/mfd/htc-i2cpld.c
index b44f0203983b..eab3fb028447 100644
--- a/drivers/mfd/htc-i2cpld.c
+++ b/drivers/mfd/htc-i2cpld.c
@@ -481,15 +481,9 @@ static int htcpld_register_chip_gpio(
481 481
482 ret = gpiochip_add(&(chip->chip_in)); 482 ret = gpiochip_add(&(chip->chip_in));
483 if (ret) { 483 if (ret) {
484 int error;
485
486 dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n", 484 dev_warn(dev, "Unable to register input GPIOs for 0x%x: %d\n",
487 plat_chip_data->addr, ret); 485 plat_chip_data->addr, ret);
488 486 gpiochip_remove(&(chip->chip_out));
489 error = gpiochip_remove(&(chip->chip_out));
490 if (error)
491 dev_warn(dev, "Error while trying to unregister gpio chip: %d\n", error);
492
493 return ret; 487 return ret;
494 } 488 }
495 489
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c
index 81e6d0932bf0..02027b7f1223 100644
--- a/drivers/mfd/sm501.c
+++ b/drivers/mfd/sm501.c
@@ -1047,7 +1047,6 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
1047 struct sm501_gpio *gpio = &sm->gpio; 1047 struct sm501_gpio *gpio = &sm->gpio;
1048 resource_size_t iobase = sm->io_res->start + SM501_GPIO; 1048 resource_size_t iobase = sm->io_res->start + SM501_GPIO;
1049 int ret; 1049 int ret;
1050 int tmp;
1051 1050
1052 dev_dbg(sm->dev, "registering gpio block %08llx\n", 1051 dev_dbg(sm->dev, "registering gpio block %08llx\n",
1053 (unsigned long long)iobase); 1052 (unsigned long long)iobase);
@@ -1086,11 +1085,7 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
1086 return 0; 1085 return 0;
1087 1086
1088 err_low_chip: 1087 err_low_chip:
1089 tmp = gpiochip_remove(&gpio->low.gpio); 1088 gpiochip_remove(&gpio->low.gpio);
1090 if (tmp) {
1091 dev_err(sm->dev, "cannot remove low chip, cannot tidy up\n");
1092 return ret;
1093 }
1094 1089
1095 err_mapped: 1090 err_mapped:
1096 iounmap(gpio->regs); 1091 iounmap(gpio->regs);
@@ -1105,18 +1100,12 @@ static int sm501_register_gpio(struct sm501_devdata *sm)
1105static void sm501_gpio_remove(struct sm501_devdata *sm) 1100static void sm501_gpio_remove(struct sm501_devdata *sm)
1106{ 1101{
1107 struct sm501_gpio *gpio = &sm->gpio; 1102 struct sm501_gpio *gpio = &sm->gpio;
1108 int ret;
1109 1103
1110 if (!sm->gpio.registered) 1104 if (!sm->gpio.registered)
1111 return; 1105 return;
1112 1106
1113 ret = gpiochip_remove(&gpio->low.gpio); 1107 gpiochip_remove(&gpio->low.gpio);
1114 if (ret) 1108 gpiochip_remove(&gpio->high.gpio);
1115 dev_err(sm->dev, "cannot remove low chip, cannot tidy up\n");
1116
1117 ret = gpiochip_remove(&gpio->high.gpio);
1118 if (ret)
1119 dev_err(sm->dev, "cannot remove high chip, cannot tidy up\n");
1120 1109
1121 iounmap(gpio->regs); 1110 iounmap(gpio->regs);
1122 release_resource(gpio->regs_res); 1111 release_resource(gpio->regs_res);
diff --git a/drivers/mfd/tc6393xb.c b/drivers/mfd/tc6393xb.c
index 11c19e538551..4fac16bcd732 100644
--- a/drivers/mfd/tc6393xb.c
+++ b/drivers/mfd/tc6393xb.c
@@ -607,7 +607,7 @@ static int tc6393xb_probe(struct platform_device *dev)
607 struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev); 607 struct tc6393xb_platform_data *tcpd = dev_get_platdata(&dev->dev);
608 struct tc6393xb *tc6393xb; 608 struct tc6393xb *tc6393xb;
609 struct resource *iomem, *rscr; 609 struct resource *iomem, *rscr;
610 int ret, temp; 610 int ret;
611 611
612 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0); 612 iomem = platform_get_resource(dev, IORESOURCE_MEM, 0);
613 if (!iomem) 613 if (!iomem)
@@ -714,7 +714,7 @@ err_setup:
714 714
715err_gpio_add: 715err_gpio_add:
716 if (tc6393xb->gpio.base != -1) 716 if (tc6393xb->gpio.base != -1)
717 temp = gpiochip_remove(&tc6393xb->gpio); 717 gpiochip_remove(&tc6393xb->gpio);
718 tcpd->disable(dev); 718 tcpd->disable(dev);
719err_enable: 719err_enable:
720 clk_disable(tc6393xb->clk); 720 clk_disable(tc6393xb->clk);
@@ -744,13 +744,8 @@ static int tc6393xb_remove(struct platform_device *dev)
744 744
745 tc6393xb_detach_irq(dev); 745 tc6393xb_detach_irq(dev);
746 746
747 if (tc6393xb->gpio.base != -1) { 747 if (tc6393xb->gpio.base != -1)
748 ret = gpiochip_remove(&tc6393xb->gpio); 748 gpiochip_remove(&tc6393xb->gpio);
749 if (ret) {
750 dev_err(&dev->dev, "Can't remove gpio chip: %d\n", ret);
751 return ret;
752 }
753 }
754 749
755 ret = tcpd->disable(dev); 750 ret = tcpd->disable(dev);
756 clk_disable(tc6393xb->clk); 751 clk_disable(tc6393xb->clk);
diff --git a/drivers/mfd/ucb1x00-core.c b/drivers/mfd/ucb1x00-core.c
index 153d595afaac..58ea9fdd3a15 100644
--- a/drivers/mfd/ucb1x00-core.c
+++ b/drivers/mfd/ucb1x00-core.c
@@ -621,7 +621,6 @@ static void ucb1x00_remove(struct mcp *mcp)
621 struct ucb1x00_plat_data *pdata = mcp->attached_device.platform_data; 621 struct ucb1x00_plat_data *pdata = mcp->attached_device.platform_data;
622 struct ucb1x00 *ucb = mcp_get_drvdata(mcp); 622 struct ucb1x00 *ucb = mcp_get_drvdata(mcp);
623 struct list_head *l, *n; 623 struct list_head *l, *n;
624 int ret;
625 624
626 mutex_lock(&ucb1x00_mutex); 625 mutex_lock(&ucb1x00_mutex);
627 list_del(&ucb->node); 626 list_del(&ucb->node);
@@ -631,11 +630,8 @@ static void ucb1x00_remove(struct mcp *mcp)
631 } 630 }
632 mutex_unlock(&ucb1x00_mutex); 631 mutex_unlock(&ucb1x00_mutex);
633 632
634 if (ucb->gpio.base != -1) { 633 if (ucb->gpio.base != -1)
635 ret = gpiochip_remove(&ucb->gpio); 634 gpiochip_remove(&ucb->gpio);
636 if (ret)
637 dev_err(&ucb->dev, "Can't remove gpio chip: %d\n", ret);
638 }
639 635
640 irq_set_chained_handler(ucb->irq, NULL); 636 irq_set_chained_handler(ucb->irq, NULL);
641 irq_free_descs(ucb->irq_base, 16); 637 irq_free_descs(ucb->irq_base, 16);
diff --git a/drivers/platform/x86/intel_pmic_gpio.c b/drivers/platform/x86/intel_pmic_gpio.c
index 40929e4f7ad7..04fed00b88e9 100644
--- a/drivers/platform/x86/intel_pmic_gpio.c
+++ b/drivers/platform/x86/intel_pmic_gpio.c
@@ -301,8 +301,7 @@ static int platform_pmic_gpio_probe(struct platform_device *pdev)
301 return 0; 301 return 0;
302 302
303fail_request_irq: 303fail_request_irq:
304 if (gpiochip_remove(&pg->chip)) 304 gpiochip_remove(&pg->chip);
305 pr_err("gpiochip_remove failed\n");
306err: 305err:
307 iounmap(pg->gpiointr); 306 iounmap(pg->gpiointr);
308err2: 307err2:
diff --git a/drivers/ssb/driver_gpio.c b/drivers/ssb/driver_gpio.c
index ba350d2035c0..f92e266d48f8 100644
--- a/drivers/ssb/driver_gpio.c
+++ b/drivers/ssb/driver_gpio.c
@@ -475,7 +475,8 @@ int ssb_gpio_unregister(struct ssb_bus *bus)
475{ 475{
476 if (ssb_chipco_available(&bus->chipco) || 476 if (ssb_chipco_available(&bus->chipco) ||
477 ssb_extif_available(&bus->extif)) { 477 ssb_extif_available(&bus->extif)) {
478 return gpiochip_remove(&bus->gpio); 478 gpiochip_remove(&bus->gpio);
479 return 0;
479 } else { 480 } else {
480 SSB_WARN_ON(1); 481 SSB_WARN_ON(1);
481 } 482 }
diff --git a/drivers/staging/vme/devices/vme_pio2_gpio.c b/drivers/staging/vme/devices/vme_pio2_gpio.c
index f00af0786af3..3304d9227c3c 100644
--- a/drivers/staging/vme/devices/vme_pio2_gpio.c
+++ b/drivers/staging/vme/devices/vme_pio2_gpio.c
@@ -221,9 +221,7 @@ void pio2_gpio_exit(struct pio2_card *card)
221{ 221{
222 const char *label = card->gc.label; 222 const char *label = card->gc.label;
223 223
224 if (gpiochip_remove(&(card->gc))) 224 gpiochip_remove(&(card->gc));
225 dev_err(&card->vdev->dev, "Failed to remove GPIO\n");
226
227 kfree(label); 225 kfree(label);
228} 226}
229 227
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c
index 82573dc4d8cf..0041a64cc86e 100644
--- a/drivers/tty/serial/max310x.c
+++ b/drivers/tty/serial/max310x.c
@@ -1248,7 +1248,7 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
1248 mutex_destroy(&s->mutex); 1248 mutex_destroy(&s->mutex);
1249 1249
1250#ifdef CONFIG_GPIOLIB 1250#ifdef CONFIG_GPIOLIB
1251 WARN_ON(gpiochip_remove(&s->gpio)); 1251 gpiochip_remove(&s->gpio);
1252 1252
1253out_uart: 1253out_uart:
1254#endif 1254#endif
@@ -1263,12 +1263,10 @@ out_clk:
1263static int max310x_remove(struct device *dev) 1263static int max310x_remove(struct device *dev)
1264{ 1264{
1265 struct max310x_port *s = dev_get_drvdata(dev); 1265 struct max310x_port *s = dev_get_drvdata(dev);
1266 int i, ret = 0; 1266 int i;
1267 1267
1268#ifdef CONFIG_GPIOLIB 1268#ifdef CONFIG_GPIOLIB
1269 ret = gpiochip_remove(&s->gpio); 1269 gpiochip_remove(&s->gpio);
1270 if (ret)
1271 return ret;
1272#endif 1270#endif
1273 1271
1274 for (i = 0; i < s->uart.nr; i++) { 1272 for (i = 0; i < s->uart.nr; i++) {
@@ -1282,7 +1280,7 @@ static int max310x_remove(struct device *dev)
1282 uart_unregister_driver(&s->uart); 1280 uart_unregister_driver(&s->uart);
1283 clk_disable_unprepare(s->clk); 1281 clk_disable_unprepare(s->clk);
1284 1282
1285 return ret; 1283 return 0;
1286} 1284}
1287 1285
1288static const struct of_device_id __maybe_unused max310x_dt_ids[] = { 1286static const struct of_device_id __maybe_unused max310x_dt_ids[] = {
diff --git a/drivers/video/fbdev/via/via-gpio.c b/drivers/video/fbdev/via/via-gpio.c
index e408679081ab..6f433b8cee12 100644
--- a/drivers/video/fbdev/via/via-gpio.c
+++ b/drivers/video/fbdev/via/via-gpio.c
@@ -270,7 +270,7 @@ static int viafb_gpio_probe(struct platform_device *platdev)
270static int viafb_gpio_remove(struct platform_device *platdev) 270static int viafb_gpio_remove(struct platform_device *platdev)
271{ 271{
272 unsigned long flags; 272 unsigned long flags;
273 int ret = 0, i; 273 int i;
274 274
275#ifdef CONFIG_PM 275#ifdef CONFIG_PM
276 viafb_pm_unregister(&viafb_gpio_pm_hooks); 276 viafb_pm_unregister(&viafb_gpio_pm_hooks);
@@ -280,11 +280,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
280 * Get unregistered. 280 * Get unregistered.
281 */ 281 */
282 if (viafb_gpio_config.gpio_chip.ngpio > 0) { 282 if (viafb_gpio_config.gpio_chip.ngpio > 0) {
283 ret = gpiochip_remove(&viafb_gpio_config.gpio_chip); 283 gpiochip_remove(&viafb_gpio_config.gpio_chip);
284 if (ret) { /* Somebody still using it? */
285 printk(KERN_ERR "Viafb: GPIO remove failed\n");
286 return ret;
287 }
288 } 284 }
289 /* 285 /*
290 * Disable the ports. 286 * Disable the ports.
@@ -294,7 +290,7 @@ static int viafb_gpio_remove(struct platform_device *platdev)
294 viafb_gpio_disable(viafb_gpio_config.active_gpios[i]); 290 viafb_gpio_disable(viafb_gpio_config.active_gpios[i]);
295 viafb_gpio_config.gpio_chip.ngpio = 0; 291 viafb_gpio_config.gpio_chip.ngpio = 0;
296 spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags); 292 spin_unlock_irqrestore(&viafb_gpio_config.vdev->reg_lock, flags);
297 return ret; 293 return 0;
298} 294}
299 295
300static struct platform_driver via_gpio_driver = { 296static struct platform_driver via_gpio_driver = {
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 7bb0d36d4c54..a01ad629ed61 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -2319,11 +2319,8 @@ static void wm5100_init_gpio(struct i2c_client *i2c)
2319static void wm5100_free_gpio(struct i2c_client *i2c) 2319static void wm5100_free_gpio(struct i2c_client *i2c)
2320{ 2320{
2321 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); 2321 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c);
2322 int ret;
2323 2322
2324 ret = gpiochip_remove(&wm5100->gpio_chip); 2323 gpiochip_remove(&wm5100->gpio_chip);
2325 if (ret != 0)
2326 dev_err(&i2c->dev, "Failed to remove GPIOs: %d\n", ret);
2327} 2324}
2328#else 2325#else
2329static void wm5100_init_gpio(struct i2c_client *i2c) 2326static void wm5100_init_gpio(struct i2c_client *i2c)
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index aa0984864e76..c038b3e04398 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -1877,11 +1877,7 @@ static void wm8903_init_gpio(struct wm8903_priv *wm8903)
1877 1877
1878static void wm8903_free_gpio(struct wm8903_priv *wm8903) 1878static void wm8903_free_gpio(struct wm8903_priv *wm8903)
1879{ 1879{
1880 int ret; 1880 gpiochip_remove(&wm8903->gpio_chip);
1881
1882 ret = gpiochip_remove(&wm8903->gpio_chip);
1883 if (ret != 0)
1884 dev_err(wm8903->dev, "Failed to remove GPIOs: %d\n", ret);
1885} 1881}
1886#else 1882#else
1887static void wm8903_init_gpio(struct wm8903_priv *wm8903) 1883static void wm8903_init_gpio(struct wm8903_priv *wm8903)
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 1098ae32f1f9..9077411e62ce 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3398,11 +3398,8 @@ static void wm8962_init_gpio(struct snd_soc_codec *codec)
3398static void wm8962_free_gpio(struct snd_soc_codec *codec) 3398static void wm8962_free_gpio(struct snd_soc_codec *codec)
3399{ 3399{
3400 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec); 3400 struct wm8962_priv *wm8962 = snd_soc_codec_get_drvdata(codec);
3401 int ret;
3402 3401
3403 ret = gpiochip_remove(&wm8962->gpio_chip); 3402 gpiochip_remove(&wm8962->gpio_chip);
3404 if (ret != 0)
3405 dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret);
3406} 3403}
3407#else 3404#else
3408static void wm8962_init_gpio(struct snd_soc_codec *codec) 3405static void wm8962_init_gpio(struct snd_soc_codec *codec)
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index f16ff4f56923..b1dcc11c1b23 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2216,11 +2216,7 @@ static void wm8996_init_gpio(struct wm8996_priv *wm8996)
2216 2216
2217static void wm8996_free_gpio(struct wm8996_priv *wm8996) 2217static void wm8996_free_gpio(struct wm8996_priv *wm8996)
2218{ 2218{
2219 int ret; 2219 gpiochip_remove(&wm8996->gpio_chip);
2220
2221 ret = gpiochip_remove(&wm8996->gpio_chip);
2222 if (ret != 0)
2223 dev_err(wm8996->dev, "Failed to remove GPIOs: %d\n", ret);
2224} 2220}
2225#else 2221#else
2226static void wm8996_init_gpio(struct wm8996_priv *wm8996) 2222static void wm8996_init_gpio(struct wm8996_priv *wm8996)