lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAOTY_-DT--eLNMzLd0ftoo6e74yV-cfta0C8nB+5k2hifd3dg@mail.gmail.com>
Date: Thu, 22 Aug 2024 22:30:13 +0800
From: Chun-Kuang Hu <chunkuang.hu@...nel.org>
To: "Rob Herring (Arm)" <robh@...nel.org>
Cc: Chun-Kuang Hu <chunkuang.hu@...nel.org>, Philipp Zabel <p.zabel@...gutronix.de>, 
	David Airlie <airlied@...il.com>, Daniel Vetter <daniel@...ll.ch>, 
	Matthias Brugger <matthias.bgg@...il.com>, 
	AngeloGioacchino Del Regno <angelogioacchino.delregno@...labora.com>, dri-devel@...ts.freedesktop.org, 
	linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	linux-arm-kernel@...ts.infradead.org
Subject: Re: [PATCH] drm: mediatek: Drop unnecessary check for property presence

Hi, Rob:

Rob Herring (Arm) <robh@...nel.org> 於 2024年8月1日 週四 上午4:14寫道:
>
> of_property_read_u32() returns -EINVAL if a property is not present, so
> the preceeding check for presence with of_find_property() can be
> dropped. Really, what the errno is shouldn't matter. Either the property
> can be read and used or it can't and is ignored.
>
> This is part of a larger effort to remove callers of of_find_property()
> and similar functions. of_find_property() leaks the DT struct property
> and data pointers which is a problem for dynamically allocated nodes
> which may be freed.

Applied to mediatek-drm-next [1], thanks.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/chunkuang.hu/linux.git/log/?h=mediatek-drm-next

Regards,
Chun-Kuang.

>
> Signed-off-by: Rob Herring (Arm) <robh@...nel.org>
> ---
>  drivers/gpu/drm/mediatek/mtk_disp_rdma.c | 13 +++++--------
>  1 file changed, 5 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> index 634bbba5d43f..07243f372260 100644
> --- a/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> +++ b/drivers/gpu/drm/mediatek/mtk_disp_rdma.c
> @@ -341,14 +341,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
>                 dev_dbg(dev, "get mediatek,gce-client-reg fail!\n");
>  #endif
>
> -       if (of_find_property(dev->of_node, "mediatek,rdma-fifo-size", &ret)) {
> -               ret = of_property_read_u32(dev->of_node,
> -                                          "mediatek,rdma-fifo-size",
> -                                          &priv->fifo_size);
> -               if (ret)
> -                       return dev_err_probe(dev, ret,
> -                                            "Failed to get rdma fifo size\n");
> -       }
> +       ret = of_property_read_u32(dev->of_node,
> +                                  "mediatek,rdma-fifo-size",
> +                                  &priv->fifo_size);
> +       if (ret && (ret != -EINVAL))
> +               return dev_err_probe(dev, ret, "Failed to get rdma fifo size\n");
>
>         /* Disable and clear pending interrupts */
>         writel(0x0, priv->regs + DISP_REG_RDMA_INT_ENABLE);
> --
> 2.43.0
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ