Skip to content

Commit 00335fc

Browse files
robherringChun-Kuang Hu
authored andcommitted
drm/mediatek: Drop unnecessary check for property presence
of_property_read_u32() returns -EINVAL if a property is not present, so the preceding 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. Signed-off-by: Rob Herring (Arm) <[email protected]> Reviewed-by: AngeloGioacchino Del Regno <[email protected]> Reviewed-by: CK Hu <[email protected]> Link: https://patchwork.kernel.org/project/dri-devel/patch/[email protected]/ Signed-off-by: Chun-Kuang Hu <[email protected]>
1 parent 103b907 commit 00335fc

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

drivers/gpu/drm/mediatek/mtk_disp_rdma.c

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -341,14 +341,11 @@ static int mtk_disp_rdma_probe(struct platform_device *pdev)
341341
dev_dbg(dev, "get mediatek,gce-client-reg fail!\n");
342342
#endif
343343

344-
if (of_find_property(dev->of_node, "mediatek,rdma-fifo-size", &ret)) {
345-
ret = of_property_read_u32(dev->of_node,
346-
"mediatek,rdma-fifo-size",
347-
&priv->fifo_size);
348-
if (ret)
349-
return dev_err_probe(dev, ret,
350-
"Failed to get rdma fifo size\n");
351-
}
344+
ret = of_property_read_u32(dev->of_node,
345+
"mediatek,rdma-fifo-size",
346+
&priv->fifo_size);
347+
if (ret && (ret != -EINVAL))
348+
return dev_err_probe(dev, ret, "Failed to get rdma fifo size\n");
352349

353350
/* Disable and clear pending interrupts */
354351
writel(0x0, priv->regs + DISP_REG_RDMA_INT_ENABLE);

0 commit comments

Comments
 (0)