Skip to content

Commit

Permalink
drivers/serial: Do not leave sysfs group in case of error in aspeed_v…
Browse files Browse the repository at this point in the history
…uart_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>
  • Loading branch information
Alexey Khoroshilov authored and Greg Kroah-Hartman committed Jul 30, 2017
1 parent 4350782 commit cbafe9d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/tty/serial/8250/8250_aspeed_vuart.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit cbafe9d

Please sign in to comment.