Re: [PATCH v4] soc/fsl/qe: fix err handling of ucc_of_parse_tdm

From: David Miller
Date: Sun Dec 30 2018 - 23:22:25 EST


From: Peng Hao <peng.hao2@xxxxxxxxxx>
Date: Sat, 29 Dec 2018 16:47:32 +0800

> +static struct resource *ucc_get_resource_by_nodename(char *name)
> +{
> + struct device_node *np;
> + struct platform_device *pdev;
> +
> + np = of_find_compatible_node(NULL, NULL, name);
> + if (!np)
> + return ERR_PTR(-EINVAL);
> +
> + pdev = of_find_device_by_node(np);
> + if (!pdev) {
> + pr_err("%pOFn: failed to lookup pdev\n", np);
> + of_node_put(np);
> + return ERR_PTR(-EINVAL);
> + }
> +
> + of_node_put(np);
> + return platform_get_resource(pdev, IORESOURCE_MEM, 0);
> +}

"of_find_device_by_node()" takes a reference to the underlying device
structure, and you never release that reference.

I am very concerned about your submission because there are many
serious problems in it. It is absolutely impossible for your v3 to
have been tested, and now this new v4 adds object reference leaks.