Commit ba70bbfd authored by Rob Herring (Arm)'s avatar Rob Herring (Arm) Committed by Mathieu Poirier

remoteproc: Use of_property_present()

Use of_property_present() to test for property presence rather than
of_(find|get)_property(). 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: default avatarRob Herring (Arm) <robh@kernel.org>
Link: https://lore.kernel.org/r/20240731191312.1710417-7-robh@kernel.orgSigned-off-by: default avatarMathieu Poirier <mathieu.poirier@linaro.org>
parent 8749919d
...@@ -509,7 +509,7 @@ static int imx_dsp_rproc_mbox_alloc(struct imx_dsp_rproc *priv) ...@@ -509,7 +509,7 @@ static int imx_dsp_rproc_mbox_alloc(struct imx_dsp_rproc *priv)
struct mbox_client *cl; struct mbox_client *cl;
int ret; int ret;
if (!of_get_property(dev->of_node, "mbox-names", NULL)) if (!of_property_present(dev->of_node, "mbox-names"))
return 0; return 0;
cl = &priv->cl; cl = &priv->cl;
......
...@@ -812,7 +812,7 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc) ...@@ -812,7 +812,7 @@ static int imx_rproc_xtr_mbox_init(struct rproc *rproc)
if (priv->tx_ch && priv->rx_ch) if (priv->tx_ch && priv->rx_ch)
return 0; return 0;
if (!of_get_property(dev->of_node, "mbox-names", NULL)) if (!of_property_present(dev->of_node, "mbox-names"))
return 0; return 0;
cl = &priv->cl; cl = &priv->cl;
......
...@@ -1059,7 +1059,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, ...@@ -1059,7 +1059,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
r5_core = cluster->r5_cores[0]; r5_core = cluster->r5_cores[0];
/* Maintain backward compatibility for zynqmp by using hardcode TCM address. */ /* Maintain backward compatibility for zynqmp by using hardcode TCM address. */
if (of_find_property(r5_core->np, "reg", NULL)) if (of_property_present(r5_core->np, "reg"))
ret = zynqmp_r5_get_tcm_node_from_dt(cluster); ret = zynqmp_r5_get_tcm_node_from_dt(cluster);
else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss")) else if (device_is_compatible(dev, "xlnx,zynqmp-r5fss"))
ret = zynqmp_r5_get_tcm_node(cluster); ret = zynqmp_r5_get_tcm_node(cluster);
...@@ -1086,7 +1086,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster, ...@@ -1086,7 +1086,7 @@ static int zynqmp_r5_core_init(struct zynqmp_r5_cluster *cluster,
return ret; return ret;
} }
if (of_find_property(dev_of_node(dev), "xlnx,tcm-mode", NULL) || if (of_property_present(dev_of_node(dev), "xlnx,tcm-mode") ||
device_is_compatible(dev, "xlnx,zynqmp-r5fss")) { device_is_compatible(dev, "xlnx,zynqmp-r5fss")) {
ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id, ret = zynqmp_pm_set_tcm_config(r5_core->pm_domain_id,
tcm_mode); tcm_mode);
...@@ -1147,7 +1147,7 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster) ...@@ -1147,7 +1147,7 @@ static int zynqmp_r5_cluster_init(struct zynqmp_r5_cluster *cluster)
return -EINVAL; return -EINVAL;
} }
if (of_find_property(dev_node, "xlnx,tcm-mode", NULL)) { if (of_property_present(dev_node, "xlnx,tcm-mode")) {
ret = of_property_read_u32(dev_node, "xlnx,tcm-mode", (u32 *)&tcm_mode); ret = of_property_read_u32(dev_node, "xlnx,tcm-mode", (u32 *)&tcm_mode);
if (ret) if (ret)
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment