diff options
author | Soren Brinkmann <soren.brinkmann@xilinx.com> | 2013-10-17 17:08:04 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-10-19 22:47:37 -0400 |
commit | 991fc259361eb812ebf6c4527343d60ab4b2e1a6 (patch) | |
tree | 7c2493984d5d620d4f0d12682120158b6381bbec /drivers/tty | |
parent | 731d9cae0204a8948c7db2f551edcd5d5822ed95 (diff) |
tty: xuartps: Use devm_clk_get()
Use the device managed interface for clocks, simplifying error paths.
Signed-off-by: Soren Brinkmann <soren.brinkmann@xilinx.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty')
-rw-r--r-- | drivers/tty/serial/xilinx_uartps.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/tty/serial/xilinx_uartps.c b/drivers/tty/serial/xilinx_uartps.c index 7e4150aa69c6..103ba8826d06 100644 --- a/drivers/tty/serial/xilinx_uartps.c +++ b/drivers/tty/serial/xilinx_uartps.c | |||
@@ -953,23 +953,23 @@ static int xuartps_probe(struct platform_device *pdev) | |||
953 | if (!xuartps_data) | 953 | if (!xuartps_data) |
954 | return -ENOMEM; | 954 | return -ENOMEM; |
955 | 955 | ||
956 | xuartps_data->aperclk = clk_get(&pdev->dev, "aper_clk"); | 956 | xuartps_data->aperclk = devm_clk_get(&pdev->dev, "aper_clk"); |
957 | if (IS_ERR(xuartps_data->aperclk)) { | 957 | if (IS_ERR(xuartps_data->aperclk)) { |
958 | dev_err(&pdev->dev, "aper_clk clock not found.\n"); | 958 | dev_err(&pdev->dev, "aper_clk clock not found.\n"); |
959 | rc = PTR_ERR(xuartps_data->aperclk); | 959 | rc = PTR_ERR(xuartps_data->aperclk); |
960 | goto err_out_free; | 960 | goto err_out_free; |
961 | } | 961 | } |
962 | xuartps_data->refclk = clk_get(&pdev->dev, "ref_clk"); | 962 | xuartps_data->refclk = devm_clk_get(&pdev->dev, "ref_clk"); |
963 | if (IS_ERR(xuartps_data->refclk)) { | 963 | if (IS_ERR(xuartps_data->refclk)) { |
964 | dev_err(&pdev->dev, "ref_clk clock not found.\n"); | 964 | dev_err(&pdev->dev, "ref_clk clock not found.\n"); |
965 | rc = PTR_ERR(xuartps_data->refclk); | 965 | rc = PTR_ERR(xuartps_data->refclk); |
966 | goto err_out_clk_put_aper; | 966 | goto err_out_free; |
967 | } | 967 | } |
968 | 968 | ||
969 | rc = clk_prepare_enable(xuartps_data->aperclk); | 969 | rc = clk_prepare_enable(xuartps_data->aperclk); |
970 | if (rc) { | 970 | if (rc) { |
971 | dev_err(&pdev->dev, "Unable to enable APER clock.\n"); | 971 | dev_err(&pdev->dev, "Unable to enable APER clock.\n"); |
972 | goto err_out_clk_put; | 972 | goto err_out_free; |
973 | } | 973 | } |
974 | rc = clk_prepare_enable(xuartps_data->refclk); | 974 | rc = clk_prepare_enable(xuartps_data->refclk); |
975 | if (rc) { | 975 | if (rc) { |
@@ -1020,10 +1020,6 @@ err_out_clk_disable: | |||
1020 | clk_disable_unprepare(xuartps_data->refclk); | 1020 | clk_disable_unprepare(xuartps_data->refclk); |
1021 | err_out_clk_dis_aper: | 1021 | err_out_clk_dis_aper: |
1022 | clk_disable_unprepare(xuartps_data->aperclk); | 1022 | clk_disable_unprepare(xuartps_data->aperclk); |
1023 | err_out_clk_put: | ||
1024 | clk_put(xuartps_data->refclk); | ||
1025 | err_out_clk_put_aper: | ||
1026 | clk_put(xuartps_data->aperclk); | ||
1027 | err_out_free: | 1023 | err_out_free: |
1028 | kfree(xuartps_data); | 1024 | kfree(xuartps_data); |
1029 | 1025 | ||
@@ -1047,8 +1043,6 @@ static int xuartps_remove(struct platform_device *pdev) | |||
1047 | port->mapbase = 0; | 1043 | port->mapbase = 0; |
1048 | clk_disable_unprepare(xuartps_data->refclk); | 1044 | clk_disable_unprepare(xuartps_data->refclk); |
1049 | clk_disable_unprepare(xuartps_data->aperclk); | 1045 | clk_disable_unprepare(xuartps_data->aperclk); |
1050 | clk_put(xuartps_data->refclk); | ||
1051 | clk_put(xuartps_data->aperclk); | ||
1052 | kfree(xuartps_data); | 1046 | kfree(xuartps_data); |
1053 | return rc; | 1047 | return rc; |
1054 | } | 1048 | } |