@@ -581,6 +581,20 @@ static int imx_ldb_panel_ddc(struct device *dev,
return 0;
}
+static void ipu_ldb_init_encoder_head(struct imx_ldb *imx_ldb)
+{
+ struct imx_ldb_channel *imx_ldb_ch;
+ struct drm_encoder *encoder;
+
+ imx_ldb_ch = &imx_ldb->channel[0];
+ encoder = &imx_ldb_ch->encoder;
+ INIT_LIST_HEAD(&encoder->head);
+
+ imx_ldb_ch = &imx_ldb->channel[1];
+ encoder = &imx_ldb_ch->encoder;
+ INIT_LIST_HEAD(&encoder->head);
+}
+
static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
{
struct drm_device *drm = data;
@@ -597,6 +611,8 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
if (!imx_ldb)
return -ENOMEM;
+ ipu_ldb_init_encoder_head(imx_ldb);
+
imx_ldb->regmap = syscon_regmap_lookup_by_phandle(np, "gpr");
if (IS_ERR(imx_ldb->regmap)) {
dev_err(dev, "failed to get parent regmap\n");
The list head is not initialised after imx_ldb_bind allocates the imx_ldb object. Ensure it will be valid before anyone uses it. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- drivers/gpu/drm/imx/imx-ldb.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)