Re: [PATCH v17 14/21] drm/mediatek: add ETHDR support for MT8195

From: Philipp Zabel
Date: Mon Apr 25 2022 - 06:01:10 EST


On Sa, 2022-04-16 at 10:07 +0800, Nancy.Lin wrote:
> ETHDR is a part of ovl_adaptor.
> ETHDR is designed for HDR video and graphics conversion in the external
> display path. It handles multiple HDR input types and performs tone
> mapping, color space/color format conversion, and then combine
> different layers, output the required HDR or SDR signal to the
> subsequent display path.
>
> Signed-off-by: Nancy.Lin <nancy.lin@xxxxxxxxxxxx>
> Reviewed-by: Chun-Kuang Hu <chunkuang.hu@xxxxxxxxxx>
> Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@xxxxxxxxxxxxx>
> ---
[...]
> +static int mtk_ethdr_probe(struct platform_device *pdev)
> +{
> + struct device *dev = &pdev->dev;
> + struct mtk_ethdr *priv;
> + int ret;
> + int i;
> +
> + dev_info(dev, "%s+\n", __func__);

Left-over debug statements?

> +
> + priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + for (i = 0; i < ETHDR_ID_MAX; i++) {
> + priv->ethdr_comp[i].dev = dev;
> + priv->ethdr_comp[i].regs = of_iomap(dev->of_node, i);
> +#if IS_REACHABLE(CONFIG_MTK_CMDQ)
> + ret = cmdq_dev_get_client_reg(dev,
> + &priv->ethdr_comp[i].cmdq_base, i);
> + if (ret)
> + dev_dbg(dev, "get mediatek,gce-client-reg fail!\n");
> +#endif
> + dev_dbg(dev, "[DRM]regs:0x%p, node:%d\n", priv->ethdr_comp[i].regs, i);
> + }
> +
> + for (i = 0; i < ETHDR_CLK_NUM; i++)
> + priv->ethdr_clk[i].id = ethdr_clk_str[i];
> + ret = devm_clk_bulk_get_optional(dev, ETHDR_CLK_NUM, priv->ethdr_clk);
> + if (ret)
> + return ret;
> +
> + priv->irq = platform_get_irq(pdev, 0);
> + if (priv->irq < 0)
> + priv->irq = 0;
> +
> + if (priv->irq) {
> + ret = devm_request_irq(dev, priv->irq, mtk_ethdr_irq_handler,
> + IRQF_TRIGGER_NONE, dev_name(dev), priv);
> + if (ret < 0) {
> + dev_err(dev, "Failed to request irq %d: %d\n", priv->irq, ret);
> + return ret;
> + }
> + }
> +
> + priv->reset_ctl = devm_reset_control_array_get_optional_exclusive(dev);

This is missing error handling. You could use dev_err_probe() here.

regards
Philipp