Commit d3ed97035b2ed8be0c67768ca7e050547d860ca5
Committed by
Linus Torvalds
1 parent
678268e534
Exists in
master
and in
20 other branches
video: exynos_dp: add missing of_node_put()
of_find_node_by_name() returns a node pointer with refcount incremented, use of_node_put() on it when done. of_find_node_by_name() will call of_node_put() against the node pass to from parameter, thus we also need to call of_node_get(from) before calling of_find_node_by_name(). Signed-off-by: Jingoo Han <jg1.han@samsung.com> Cc: Florian Tobias Schandinat <FlorianSchandinat@gmx.de> Cc: Ajay Kumar <ajaykumar.rs@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 13 additions and 6 deletions Side-by-side Diff
drivers/video/exynos/exynos_dp_core.c
... | ... | @@ -965,10 +965,11 @@ |
965 | 965 | |
966 | 966 | static int exynos_dp_dt_parse_phydata(struct exynos_dp_device *dp) |
967 | 967 | { |
968 | - struct device_node *dp_phy_node; | |
968 | + struct device_node *dp_phy_node = of_node_get(dp->dev->of_node); | |
969 | 969 | u32 phy_base; |
970 | + int ret = 0; | |
970 | 971 | |
971 | - dp_phy_node = of_find_node_by_name(dp->dev->of_node, "dptx-phy"); | |
972 | + dp_phy_node = of_find_node_by_name(dp_phy_node, "dptx-phy"); | |
972 | 973 | if (!dp_phy_node) { |
973 | 974 | dev_err(dp->dev, "could not find dptx-phy node\n"); |
974 | 975 | return -ENODEV; |
975 | 976 | |
976 | 977 | |
977 | 978 | |
... | ... | @@ -976,22 +977,28 @@ |
976 | 977 | |
977 | 978 | if (of_property_read_u32(dp_phy_node, "reg", &phy_base)) { |
978 | 979 | dev_err(dp->dev, "faild to get reg for dptx-phy\n"); |
979 | - return -EINVAL; | |
980 | + ret = -EINVAL; | |
981 | + goto err; | |
980 | 982 | } |
981 | 983 | |
982 | 984 | if (of_property_read_u32(dp_phy_node, "samsung,enable-mask", |
983 | 985 | &dp->enable_mask)) { |
984 | 986 | dev_err(dp->dev, "faild to get enable-mask for dptx-phy\n"); |
985 | - return -EINVAL; | |
987 | + ret = -EINVAL; | |
988 | + goto err; | |
986 | 989 | } |
987 | 990 | |
988 | 991 | dp->phy_addr = ioremap(phy_base, SZ_4); |
989 | 992 | if (!dp->phy_addr) { |
990 | 993 | dev_err(dp->dev, "failed to ioremap dp-phy\n"); |
991 | - return -ENOMEM; | |
994 | + ret = -ENOMEM; | |
995 | + goto err; | |
992 | 996 | } |
993 | 997 | |
994 | - return 0; | |
998 | +err: | |
999 | + of_node_put(dp_phy_node); | |
1000 | + | |
1001 | + return ret; | |
995 | 1002 | } |
996 | 1003 | |
997 | 1004 | static void exynos_dp_phy_init(struct exynos_dp_device *dp) |