0448-gpu-drm-vc4_hdmi-add-missing-of_node_put-after-calli.patch 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. From 46c6aaecefb953f629a7dddd2cb1eb70d3d6c954 Mon Sep 17 00:00:00 2001
  2. From: Peter Chen <peter.chen@nxp.com>
  3. Date: Tue, 5 Jul 2016 10:04:54 +0800
  4. Subject: [PATCH] gpu: drm: vc4_hdmi: add missing of_node_put after calling
  5. of_parse_phandle
  6. of_node_put needs to be called when the device node which is got
  7. from of_parse_phandle has finished using.
  8. Signed-off-by: Peter Chen <peter.chen@nxp.com>
  9. Reviewed-by: Eric Anholt <eric@anholt.net>
  10. (cherry picked from commit 027a697677b0d5ff211773596d96f84078ceda80)
  11. ---
  12. drivers/gpu/drm/vc4/vc4_hdmi.c | 13 +++++++------
  13. 1 file changed, 7 insertions(+), 6 deletions(-)
  14. --- a/drivers/gpu/drm/vc4/vc4_hdmi.c
  15. +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c
  16. @@ -467,12 +467,6 @@ static int vc4_hdmi_bind(struct device *
  17. if (IS_ERR(hdmi->hd_regs))
  18. return PTR_ERR(hdmi->hd_regs);
  19. - ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
  20. - if (!ddc_node) {
  21. - DRM_ERROR("Failed to find ddc node in device tree\n");
  22. - return -ENODEV;
  23. - }
  24. -
  25. hdmi->pixel_clock = devm_clk_get(dev, "pixel");
  26. if (IS_ERR(hdmi->pixel_clock)) {
  27. DRM_ERROR("Failed to get pixel clock\n");
  28. @@ -484,7 +478,14 @@ static int vc4_hdmi_bind(struct device *
  29. return PTR_ERR(hdmi->hsm_clock);
  30. }
  31. + ddc_node = of_parse_phandle(dev->of_node, "ddc", 0);
  32. + if (!ddc_node) {
  33. + DRM_ERROR("Failed to find ddc node in device tree\n");
  34. + return -ENODEV;
  35. + }
  36. +
  37. hdmi->ddc = of_find_i2c_adapter_by_node(ddc_node);
  38. + of_node_put(ddc_node);
  39. if (!hdmi->ddc) {
  40. DRM_DEBUG("Failed to get ddc i2c adapter by node\n");
  41. return -EPROBE_DEFER;