Hi, Nishka:

On Sat, 2019-07-06 at 19:00 +0530, Nishka Dasgupta wrote:
> Each iteration of for_each_child_of_node puts the previous
> node, but in the case of a goto from the middle of the loop, there is
> no put, thus causing a memory leak. Hence add an of_node_put before the
> goto in two places.
> Issue found with Coccinelle.

Applied to mediatek-drm-fixes-5.3 [1], thanks.

[1]
https://github.com/ckhu-mediatek/linux.git-tags/tree/mediatek-drm-fixes-5.3

Regards,
CK

> 
> Signed-off-by: Nishka Dasgupta <nishkadg.li...@gmail.com>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c 
> b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 95fdbd0fbcac..2dffbc8c6d73 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -524,12 +524,15 @@ static int mtk_drm_probe(struct platform_device *pdev)
>                       comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
>                       if (!comp) {
>                               ret = -ENOMEM;
> +                             of_node_put(node);
>                               goto err_node;
>                       }
>  
>                       ret = mtk_ddp_comp_init(dev, node, comp, comp_id, NULL);
> -                     if (ret)
> +                     if (ret) {
> +                             of_node_put(node);
>                               goto err_node;
> +                     }
>  
>                       private->ddp_comp[comp_id] = comp;
>               }


_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reply via email to