Commit 475ac0a1 authored by Rob Clark's avatar Rob Clark

drm/msm/hdmi: fix memory leak after bridge changes

3d3f8b1f ("drm/bridge: make bridge registration independent of drm
flow") resulted that the hdmi bridge object would be leaked at teardown.
Just switch over to devm_kzalloc() as the easy way to solve this.
Signed-off-by: default avatarRob Clark <robdclark@gmail.com>
parent 0b776d45
...@@ -25,8 +25,6 @@ struct hdmi_bridge { ...@@ -25,8 +25,6 @@ struct hdmi_bridge {
void hdmi_bridge_destroy(struct drm_bridge *bridge) void hdmi_bridge_destroy(struct drm_bridge *bridge)
{ {
struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge);
kfree(hdmi_bridge);
} }
static void power_on(struct drm_bridge *bridge) static void power_on(struct drm_bridge *bridge)
...@@ -209,7 +207,8 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi) ...@@ -209,7 +207,8 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
struct hdmi_bridge *hdmi_bridge; struct hdmi_bridge *hdmi_bridge;
int ret; int ret;
hdmi_bridge = kzalloc(sizeof(*hdmi_bridge), GFP_KERNEL); hdmi_bridge = devm_kzalloc(hdmi->dev->dev,
sizeof(*hdmi_bridge), GFP_KERNEL);
if (!hdmi_bridge) { if (!hdmi_bridge) {
ret = -ENOMEM; ret = -ENOMEM;
goto fail; goto fail;
...@@ -220,7 +219,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi) ...@@ -220,7 +219,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
bridge = &hdmi_bridge->base; bridge = &hdmi_bridge->base;
bridge->funcs = &hdmi_bridge_funcs; bridge->funcs = &hdmi_bridge_funcs;
drm_bridge_attach(hdmi->dev, bridge); ret = drm_bridge_attach(hdmi->dev, bridge);
if (ret)
goto fail;
return bridge; return bridge;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment