summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2015-01-31 11:45:09 -0500
committerRob Clark <robdclark@gmail.com>2015-02-01 15:23:35 -0500
commit475ac0a13dfe108b80fbb89f54414de1a07a0d25 (patch)
tree73d7b0938b463a87f9acd5bc39a4fe9d3e121f93
parent0b776d457b9476e96a65d4daace8d8f668e010d4 (diff)
drm/msm/hdmi: fix memory leak after bridge changes
3d3f8b1f8b ("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: Rob Clark <robdclark@gmail.com>
-rw-r--r--drivers/gpu/drm/msm/hdmi/hdmi_bridge.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
index d6f8d5818e18..a7a1d8267cf0 100644
--- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
+++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c
@@ -25,8 +25,6 @@ struct hdmi_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)
@@ -209,7 +207,8 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
struct hdmi_bridge *hdmi_bridge;
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) {
ret = -ENOMEM;
goto fail;
@@ -220,7 +219,9 @@ struct drm_bridge *hdmi_bridge_init(struct hdmi *hdmi)
bridge = &hdmi_bridge->base;
bridge->funcs = &hdmi_bridge_funcs;
- drm_bridge_attach(hdmi->dev, bridge);
+ ret = drm_bridge_attach(hdmi->dev, bridge);
+ if (ret)
+ goto fail;
return bridge;