[PATCH v7 25/43] drm/mediatek: mtk_hdmi: Use dev_err_probe() in mtk_hdmi_dt_parse_pdata()
CK Hu (胡俊光)
ck.hu at mediatek.com
Wed Feb 26 21:42:14 PST 2025
Hi, Angelo:
On Mon, 2025-02-17 at 16:48 +0100, AngeloGioacchino Del Regno wrote:
> External email : Please do not click links or open attachments until you have verified the sender or the content.
>
>
> Change error prints to use dev_err_probe() instead of dev_err()
> where possible in function mtk_hdmi_dt_parse_pdata(), used only
> during device probe.
> While at it, also beautify some prints.
I would apply bug-fix, cleanup, and refinement patches first and then apply v2 related patches.
So bug-fix, cleanup, and refinement patches could be backported to old version branch without any v2 related patches.
When I apply this patch, conflicts happen.
Please rebase this series onto mediatek-drm-next, and apply this patch before v2 related patches.
Regards,
CK
>
> Reviewed-by: CK Hu <ck.hu at mediatek.com>
> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno at collabora.com>
> ---
> drivers/gpu/drm/mediatek/mtk_hdmi.c | 31 ++++++++++-------------------
> 1 file changed, 10 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi.c b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> index 4bf19574463d..61e521430b48 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi.c
> @@ -1372,25 +1372,19 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
> {
> struct device *dev = &pdev->dev;
> struct device_node *np = dev->of_node;
> - struct device_node *cec_np, *remote, *i2c_np;
> + struct device_node *remote, *i2c_np;
> struct platform_device *cec_pdev;
> struct regmap *regmap;
> int ret;
>
> ret = mtk_hdmi_get_all_clk(hdmi, np);
> - if (ret) {
> - if (ret != -EPROBE_DEFER)
> - dev_err(dev, "Failed to get clocks: %d\n", ret);
> -
> - return ret;
> - }
> + if (ret)
> + return dev_err_probe(dev, ret, "Failed to get clocks\n");
>
> /* The CEC module handles HDMI hotplug detection */
> cec_np = of_get_compatible_child(np->parent, "mediatek,mt8173-cec");
> - if (!cec_np) {
> - dev_err(dev, "Failed to find CEC node\n");
> - return -EINVAL;
> - }
> + if (!cec_np)
> + return dev_err_probe(dev, -EINVAL, "Failed to find CEC node\n");
>
> cec_pdev = of_find_device_by_node(cec_np);
> if (!cec_pdev) {
> @@ -1413,9 +1407,8 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
> if (IS_ERR(regmap))
> ret = PTR_ERR(regmap);
> if (ret) {
> - dev_err(dev,
> - "Failed to get system configuration registers: %d\n",
> - ret);
> + dev_err_probe(dev, ret,
> + "Failed to get system configuration registers\n");
> goto put_device;
> }
> hdmi->sys_regmap = regmap;
> @@ -1443,20 +1436,16 @@ static int mtk_hdmi_dt_parse_pdata(struct mtk_hdmi *hdmi,
> }
>
> i2c_np = of_parse_phandle(remote, "ddc-i2c-bus", 0);
> + of_node_put(remote);
> if (!i2c_np) {
> - dev_err(dev, "Failed to find ddc-i2c-bus node in %pOF\n",
> - remote);
> - of_node_put(remote);
> - ret = -EINVAL;
> + ret = dev_err_probe(dev, -EINVAL, "No ddc-i2c-bus in connector\n");
> goto put_device;
> }
> - of_node_put(remote);
>
> hdmi->ddc_adpt = of_find_i2c_adapter_by_node(i2c_np);
> of_node_put(i2c_np);
> if (!hdmi->ddc_adpt) {
> - dev_err(dev, "Failed to get ddc i2c adapter by node\n");
> - ret = -EINVAL;
> + ret = dev_err_probe(dev, -EINVAL, "Failed to get ddc i2c adapter by node\n");
> goto put_device;
> }
>
> --
> 2.48.1
>
More information about the linux-arm-kernel
mailing list