diff options
author | Min-wuk Lee <mlee@nvidia.com> | 2014-11-25 00:52:27 -0500 |
---|---|---|
committer | Dan Willemsen <dwillemsen@nvidia.com> | 2015-03-18 15:12:24 -0400 |
commit | cb3a1dd9a33debfaa1cd6c887dcf707c0afa7352 (patch) | |
tree | 5ec89edac4f20ae8b1d4f9f5b26fbe2c996ef2a7 /drivers/video/tegra/dc/dp.c | |
parent | b29140400b48d58ef7459df307cec7ce7b2a43d1 (diff) |
video: tegra: dc: have proper of_node_put
of_node_put is needed before discarding a value received
from of_find_node_by_path, of_parse_phandle and
of_find_compatible_node in error handling code or when the
device node is no longer used, in order to avoid any
memory leak.
Bug 1371533
Change-Id: I824d10bca984e4d6e46bf2f41e30dd441f0f0668
Signed-off-by: Min-wuk Lee <mlee@nvidia.com>
Reviewed-on: http://git-master/r/655213
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
Tested-by: Bharat Nihalani <bnihalani@nvidia.com>
Diffstat (limited to 'drivers/video/tegra/dc/dp.c')
-rw-r--r-- | drivers/video/tegra/dc/dp.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/video/tegra/dc/dp.c b/drivers/video/tegra/dc/dp.c index 45b5fbac4..499052537 100644 --- a/drivers/video/tegra/dc/dp.c +++ b/drivers/video/tegra/dc/dp.c | |||
@@ -1620,8 +1620,10 @@ static int tegra_dc_dp_init(struct tegra_dc *dc) | |||
1620 | : of_find_node_by_path(DPAUX_NODE); | 1620 | : of_find_node_by_path(DPAUX_NODE); |
1621 | 1621 | ||
1622 | dp = devm_kzalloc(&dc->ndev->dev, sizeof(*dp), GFP_KERNEL); | 1622 | dp = devm_kzalloc(&dc->ndev->dev, sizeof(*dp), GFP_KERNEL); |
1623 | if (!dp) | 1623 | if (!dp) { |
1624 | of_node_put(np_dp); | ||
1624 | return -ENOMEM; | 1625 | return -ENOMEM; |
1626 | } | ||
1625 | 1627 | ||
1626 | if (np) { | 1628 | if (np) { |
1627 | if (np_dp && (of_device_is_available(np_dp) || | 1629 | if (np_dp && (of_device_is_available(np_dp) || |
@@ -1743,6 +1745,7 @@ static int tegra_dc_dp_init(struct tegra_dc *dc) | |||
1743 | 1745 | ||
1744 | tegra_dc_set_outdata(dc, dp); | 1746 | tegra_dc_set_outdata(dc, dp); |
1745 | tegra_dc_dp_debug_create(dp); | 1747 | tegra_dc_dp_debug_create(dp); |
1748 | of_node_put(np_dp); | ||
1746 | 1749 | ||
1747 | return 0; | 1750 | return 0; |
1748 | 1751 | ||
@@ -1761,6 +1764,7 @@ err_release_resource_reg: | |||
1761 | release_resource(res); | 1764 | release_resource(res); |
1762 | err_free_dp: | 1765 | err_free_dp: |
1763 | devm_kfree(&dc->ndev->dev, dp); | 1766 | devm_kfree(&dc->ndev->dev, dp); |
1767 | of_node_put(np_dp); | ||
1764 | 1768 | ||
1765 | return err; | 1769 | return err; |
1766 | } | 1770 | } |
@@ -2432,6 +2436,7 @@ static void tegra_dc_dp_destroy(struct tegra_dc *dc) | |||
2432 | if (!np_dp || !of_device_is_available(np_dp)) | 2436 | if (!np_dp || !of_device_is_available(np_dp)) |
2433 | release_resource(dp->res); | 2437 | release_resource(dp->res); |
2434 | devm_kfree(&dc->ndev->dev, dp); | 2438 | devm_kfree(&dc->ndev->dev, dp); |
2439 | of_node_put(np_dp); | ||
2435 | } | 2440 | } |
2436 | 2441 | ||
2437 | static void tegra_dc_dp_disable(struct tegra_dc *dc) | 2442 | static void tegra_dc_dp_disable(struct tegra_dc *dc) |