summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/xlnx/zynqmp_dpsub.c')
-rw-r--r--drivers/gpu/drm/xlnx/zynqmp_dpsub.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index 5d61f6c7aee5..6a6fba28fd6f 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -15,6 +15,7 @@
#include <linux/of_reserved_mem.h>
#include <linux/platform_device.h>
#include <linux/pm_runtime.h>
+#include <linux/slab.h>
#include <drm/drm_atomic_helper.h>
#include <drm/drm_bridge_connector.h>
@@ -247,6 +248,14 @@ static int zynqmp_dpsub_init_clocks(struct zynqmp_dpsub *dpsub)
return 0;
}
+static void zynqmp_dpsub_release(struct drm_device *drm, void *res)
+{
+ struct zynqmp_dpsub *dpsub = res;
+
+ kfree(dpsub->disp);
+ kfree(dpsub->dp);
+}
+
static int zynqmp_dpsub_probe(struct platform_device *pdev)
{
struct zynqmp_dpsub *dpsub;
@@ -258,6 +267,10 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
if (IS_ERR(dpsub))
return PTR_ERR(dpsub);
+ ret = drmm_add_action(&dpsub->drm, zynqmp_dpsub_release, dpsub);
+ if (ret < 0)
+ return ret;
+
dpsub->dev = &pdev->dev;
platform_set_drvdata(pdev, dpsub);
@@ -276,11 +289,11 @@ static int zynqmp_dpsub_probe(struct platform_device *pdev)
* DP should be probed first so that the zynqmp_disp can set the output
* format accordingly.
*/
- ret = zynqmp_dp_probe(dpsub, &dpsub->drm);
+ ret = zynqmp_dp_probe(dpsub);
if (ret)
goto err_pm;
- ret = zynqmp_disp_probe(dpsub, &dpsub->drm);
+ ret = zynqmp_disp_probe(dpsub);
if (ret)
goto err_dp;