[v5,3/3] drm/mediatek: Implement OF graphs support for display paths
Sui Jingfeng
suijingfeng at bosc.ac.cn
Wed May 22 05:32:53 PDT 2024
Hi,
On 5/21/24 15:57, AngeloGioacchino Del Regno wrote:
> +static int mtk_drm_of_ddp_path_build(struct device *dev, struct device_node *node,
> + struct mtk_mmsys_driver_data *data)
> +{
> + struct device_node *ep_node;
> + struct of_endpoint of_ep;
> + bool output_present[MAX_CRTC] = { false };
> + int ret;
> +
> + for_each_endpoint_of_node(node, ep_node) {
> + ret = of_graph_parse_endpoint(ep_node, &of_ep);
> + of_node_put(ep_node);
There is going to *double* decline the reference counter, as the
__of_get_next_child() will decrease the reference counter for us
on the next iteration.
> + if (ret) {
> + dev_err_probe(dev, ret, "Cannot parse endpoint\n");
> + break;
> + }
Move the 'of_node_put(ep_node)' into brace '{}' here, if we really cares
about the reference count.
> +
> + if (of_ep.id >= MAX_CRTC) {
ditto ?
> + ret = dev_err_probe(dev, -EINVAL,
> + "Invalid endpoint%u number\n", of_ep.port);
> + break;
> + }
> +
> + output_present[of_ep.id] = true;
> + }
> +
> + if (ret)
> + return ret;
> +
> + if (output_present[CRTC_MAIN]) {
> + ret = mtk_drm_of_ddp_path_build_one(dev, CRTC_MAIN,
> + &data->main_path, &data->main_len);
> + if (ret)
> + return ret;
> + }
> +
> + if (output_present[CRTC_EXT]) {
> + ret = mtk_drm_of_ddp_path_build_one(dev, CRTC_EXT,
> + &data->ext_path, &data->ext_len);
> + if (ret)
> + return ret;
> + }
> +
> + if (output_present[CRTC_THIRD]) {
> + ret = mtk_drm_of_ddp_path_build_one(dev, CRTC_THIRD,
> + &data->third_path, &data->third_len);
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
> +}
> +
--
Best regards
Sui Jingfeng
More information about the Linux-mediatek
mailing list