s->gpio.base = -1;
s->gpio.ngpio = devtype->nr * 4;
s->gpio.can_sleep = 1;
- ret = gpiochip_add_data(&s->gpio, s);
- if (ret)
- goto out_uart;
+ ret = devm_gpiochip_add_data(dev, &s->gpio, s);
+ if (ret) {
+ uart_unregister_driver(&s->uart);
+ goto out_clk;
+ }
#endif
mutex_init(&s->mutex);
mutex_destroy(&s->mutex);
-#ifdef CONFIG_GPIOLIB
- gpiochip_remove(&s->gpio);
-
-out_uart:
-#endif
uart_unregister_driver(&s->uart);
out_clk:
struct max310x_port *s = dev_get_drvdata(dev);
int i;
-#ifdef CONFIG_GPIOLIB
- gpiochip_remove(&s->gpio);
-#endif
-
for (i = 0; i < s->uart.nr; i++) {
cancel_work_sync(&s->p[i].tx_work);
cancel_work_sync(&s->p[i].md_work);