summaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorAlexey Khoroshilov <khoroshilov@ispras.ru>2017-07-28 21:54:03 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-07-30 07:37:25 -0700
commitcbafe9d5c346735d6ac5d5c905fd9c215fbbb941 (patch)
treea5b4e4d19e0c72ceafdc55854a3553c57e906bd9 /drivers/tty/serial
parent4350782570b919f254c1e083261a21c19fcaee90 (diff)
drivers/serial: Do not leave sysfs group in case of error in aspeed_vuart_probe()
There are several error handling paths in aspeed_vuart_probe(), where sysfs group is left unremoved. The patch fixes them. Found by Linux Driver Verification project (linuxtesting.org). Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/8250/8250_aspeed_vuart.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/tty/serial/8250/8250_aspeed_vuart.c b/drivers/tty/serial/8250/8250_aspeed_vuart.c
index 822be4906763..33a801353114 100644
--- a/drivers/tty/serial/8250/8250_aspeed_vuart.c
+++ b/drivers/tty/serial/8250/8250_aspeed_vuart.c
@@ -223,12 +223,13 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
if (IS_ERR(vuart->clk)) {
dev_warn(&pdev->dev,
"clk or clock-frequency not defined\n");
- return PTR_ERR(vuart->clk);
+ rc = PTR_ERR(vuart->clk);
+ goto err_sysfs_remove;
}
rc = clk_prepare_enable(vuart->clk);
if (rc < 0)
- return rc;
+ goto err_sysfs_remove;
clk = clk_get_rate(vuart->clk);
}
@@ -286,6 +287,8 @@ static int aspeed_vuart_probe(struct platform_device *pdev)
err_clk_disable:
clk_disable_unprepare(vuart->clk);
irq_dispose_mapping(port.port.irq);
+err_sysfs_remove:
+ sysfs_remove_group(&vuart->dev->kobj, &aspeed_vuart_attr_group);
return rc;
}