Skip to content

Commit

Permalink
serial: max310x: Add missing mutex_destroy() on driver exit
Browse files Browse the repository at this point in the history
Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Alexander Shiyan authored and Greg Kroah-Hartman committed Feb 13, 2014
1 parent dba29a2 commit 0fbae88
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/tty/serial/max310x.c
Original file line number Diff line number Diff line change
Expand Up @@ -1134,8 +1134,6 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
s->devtype = devtype;
dev_set_drvdata(dev, s);

mutex_init(&s->mutex);

/* Check device to ensure we are talking to what we expect */
ret = devtype->detect(dev);
if (ret)
Expand Down Expand Up @@ -1193,6 +1191,8 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,
goto out_uart;
#endif

mutex_init(&s->mutex);

for (i = 0; i < devtype->nr; i++) {
/* Initialize port data */
s->p[i].port.line = i;
Expand Down Expand Up @@ -1233,6 +1233,8 @@ static int max310x_probe(struct device *dev, struct max310x_devtype *devtype,

dev_err(dev, "Unable to reguest IRQ %i\n", irq);

mutex_destroy(&s->mutex);

#ifdef CONFIG_GPIOLIB
WARN_ON(gpiochip_remove(&s->gpio));
#endif
Expand Down Expand Up @@ -1264,6 +1266,7 @@ static int max310x_remove(struct device *dev)
s->devtype->power(&s->p[i].port, 0);
}

mutex_destroy(&s->mutex);
uart_unregister_driver(&s->uart);
clk_disable_unprepare(s->clk);

Expand Down

0 comments on commit 0fbae88

Please sign in to comment.