Skip to content

Commit c6b035e

Browse files
committed
Merge tag 'imx-drm-fixes-2022-04-06' of git://git.pengutronix.de/pza/linux into drm-fixes
drm/imx: error handling and debug output fixes Catch an EDID allocation failure in imx-ldb, fix a leaked drm display mode on DT parsing error in parallel-display, properly remove the dw_hdmi bridge in case the component_add fails in dw_hdmi-imx, and fix the IPU clock frequency debug printout in ipu-di. Signed-off-by: Dave Airlie <airlied@redhat.com> From: Philipp Zabel <p.zabel@pengutronix.de> Link: https://patchwork.freedesktop.org/patch/msgid/20220406155101.1271845-1-p.zabel@pengutronix.de
2 parents 691b592 + 070a88f commit c6b035e

4 files changed

Lines changed: 15 additions & 4 deletions

File tree

drivers/gpu/drm/imx/dw_hdmi-imx.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
222222
struct device_node *np = pdev->dev.of_node;
223223
const struct of_device_id *match = of_match_node(dw_hdmi_imx_dt_ids, np);
224224
struct imx_hdmi *hdmi;
225+
int ret;
225226

226227
hdmi = devm_kzalloc(&pdev->dev, sizeof(*hdmi), GFP_KERNEL);
227228
if (!hdmi)
@@ -243,10 +244,15 @@ static int dw_hdmi_imx_probe(struct platform_device *pdev)
243244
hdmi->bridge = of_drm_find_bridge(np);
244245
if (!hdmi->bridge) {
245246
dev_err(hdmi->dev, "Unable to find bridge\n");
247+
dw_hdmi_remove(hdmi->hdmi);
246248
return -ENODEV;
247249
}
248250

249-
return component_add(&pdev->dev, &dw_hdmi_imx_ops);
251+
ret = component_add(&pdev->dev, &dw_hdmi_imx_ops);
252+
if (ret)
253+
dw_hdmi_remove(hdmi->hdmi);
254+
255+
return ret;
250256
}
251257

252258
static int dw_hdmi_imx_remove(struct platform_device *pdev)

drivers/gpu/drm/imx/imx-ldb.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -572,6 +572,8 @@ static int imx_ldb_panel_ddc(struct device *dev,
572572
edidp = of_get_property(child, "edid", &edid_len);
573573
if (edidp) {
574574
channel->edid = kmemdup(edidp, edid_len, GFP_KERNEL);
575+
if (!channel->edid)
576+
return -ENOMEM;
575577
} else if (!channel->panel) {
576578
/* fallback to display-timings node */
577579
ret = of_get_drm_display_mode(child,

drivers/gpu/drm/imx/parallel-display.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,10 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector)
7575
ret = of_get_drm_display_mode(np, &imxpd->mode,
7676
&imxpd->bus_flags,
7777
OF_USE_NATIVE_MODE);
78-
if (ret)
78+
if (ret) {
79+
drm_mode_destroy(connector->dev, mode);
7980
return ret;
81+
}
8082

8183
drm_mode_copy(mode, &imxpd->mode);
8284
mode->type |= DRM_MODE_TYPE_DRIVER | DRM_MODE_TYPE_PREFERRED;

drivers/gpu/ipu-v3/ipu-di.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,9 @@ static void ipu_di_config_clock(struct ipu_di *di,
447447

448448
error = rate / (sig->mode.pixelclock / 1000);
449449

450-
dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %d.%u%%\n",
451-
rate, div, (signed)(error - 1000) / 10, error % 10);
450+
dev_dbg(di->ipu->dev, " IPU clock can give %lu with divider %u, error %c%d.%d%%\n",
451+
rate, div, error < 1000 ? '-' : '+',
452+
abs(error - 1000) / 10, abs(error - 1000) % 10);
452453

453454
/* Allow a 1% error */
454455
if (error < 1010 && error >= 990) {

0 commit comments

Comments
 (0)