drm/imx: imx-drm-core and imx-ldb fixes
Fix a memory leak in an error path during DRM device initialization, fix the LDB driver to register channel 1 even if channel 0 is unused, and fix an out of bounds array access warning in the LDB driver. -----BEGIN PGP SIGNATURE----- iI4EABYIADYWIQRRO6F6WdpH1R0vGibVhaclGDdiwAUCYGWEMBgccGhpbGlwcC56 YWJlbEBnbWFpbC5jb20ACgkQ1YWnJRg3YsANIgD+Kb7yLjv17TC1lfEVYK8k5nDf QKDXJJPnQm2O3KvbXDIBAPDQwEGAG3fcT1AjzahbzpntIJsqlyD0aMVSDgK4Dq4H =jeDO -----END PGP SIGNATURE----- Merge tag 'imx-drm-fixes-2021-04-01' of git://git.pengutronix.de/git/pza/linux into drm-fixes drm/imx: imx-drm-core and imx-ldb fixes Fix a memory leak in an error path during DRM device initialization, fix the LDB driver to register channel 1 even if channel 0 is unused, and fix an out of bounds array access warning in the LDB driver. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Philipp Zabel <p.zabel@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/20210401092235.GA13586@pengutronix.de
This commit is contained in:
commit
6fdb8e5aba
@ -215,7 +215,7 @@ static int imx_drm_bind(struct device *dev)
|
||||
|
||||
ret = drmm_mode_config_init(drm);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto err_kms;
|
||||
|
||||
ret = drm_vblank_init(drm, MAX_CRTC);
|
||||
if (ret)
|
||||
|
@ -197,6 +197,11 @@ static void imx_ldb_encoder_enable(struct drm_encoder *encoder)
|
||||
int dual = ldb->ldb_ctrl & LDB_SPLIT_MODE_EN;
|
||||
int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
|
||||
|
||||
if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
|
||||
dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
|
||||
return;
|
||||
}
|
||||
|
||||
drm_panel_prepare(imx_ldb_ch->panel);
|
||||
|
||||
if (dual) {
|
||||
@ -255,6 +260,11 @@ imx_ldb_encoder_atomic_mode_set(struct drm_encoder *encoder,
|
||||
int mux = drm_of_encoder_active_port_id(imx_ldb_ch->child, encoder);
|
||||
u32 bus_format = imx_ldb_ch->bus_format;
|
||||
|
||||
if (mux < 0 || mux >= ARRAY_SIZE(ldb->clk_sel)) {
|
||||
dev_warn(ldb->dev, "%s: invalid mux %d\n", __func__, mux);
|
||||
return;
|
||||
}
|
||||
|
||||
if (mode->clock > 170000) {
|
||||
dev_warn(ldb->dev,
|
||||
"%s: mode exceeds 170 MHz pixel clock\n", __func__);
|
||||
@ -583,7 +593,7 @@ static int imx_ldb_bind(struct device *dev, struct device *master, void *data)
|
||||
struct imx_ldb_channel *channel = &imx_ldb->channel[i];
|
||||
|
||||
if (!channel->ldb)
|
||||
break;
|
||||
continue;
|
||||
|
||||
ret = imx_ldb_register(drm, channel);
|
||||
if (ret)
|
||||
|
Loading…
Reference in New Issue
Block a user