diff options
author | Rob Herring (Arm) <robh@kernel.org> | 2024-07-31 13:16:00 -0600 |
---|---|---|
committer | Jakub Kicinski <kuba@kernel.org> | 2024-08-01 18:15:18 -0700 |
commit | 5fe164fb0e6e31dbcbb4b706fd76bc578e5af4c6 (patch) | |
tree | 31c20f6f8bd507c1c01532c4f090f48050330062 /drivers/net/ethernet/ti/icssg/icssg_prueth.c | |
parent | 0b0e9cdb3d1f8fda823b592b0667b4b0595e2ba7 (diff) | |
download | lwn-5fe164fb0e6e31dbcbb4b706fd76bc578e5af4c6.tar.gz lwn-5fe164fb0e6e31dbcbb4b706fd76bc578e5af4c6.zip |
net: Use of_property_read_bool()
Use of_property_read_bool() to read boolean properties rather than
of_find_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: Rob Herring (Arm) <robh@kernel.org>
Reviewed-by: MD Danish Anwar <danishanwar@ti.com>
Link: https://patch.msgid.link/20240731191601.1714639-2-robh@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'drivers/net/ethernet/ti/icssg/icssg_prueth.c')
-rw-r--r-- | drivers/net/ethernet/ti/icssg/icssg_prueth.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/ethernet/ti/icssg/icssg_prueth.c b/drivers/net/ethernet/ti/icssg/icssg_prueth.c index 3e51b3a9b0a5..9dc9de39bb8f 100644 --- a/drivers/net/ethernet/ti/icssg/icssg_prueth.c +++ b/drivers/net/ethernet/ti/icssg/icssg_prueth.c @@ -1271,8 +1271,8 @@ static int prueth_probe(struct platform_device *pdev) goto exit_iep; } - if (of_find_property(eth0_node, "ti,half-duplex-capable", NULL)) - prueth->emac[PRUETH_MAC0]->half_duplex = 1; + prueth->emac[PRUETH_MAC0]->half_duplex = + of_property_read_bool(eth0_node, "ti,half-duplex-capable"); prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; } @@ -1285,8 +1285,8 @@ static int prueth_probe(struct platform_device *pdev) goto netdev_exit; } - if (of_find_property(eth1_node, "ti,half-duplex-capable", NULL)) - prueth->emac[PRUETH_MAC1]->half_duplex = 1; + prueth->emac[PRUETH_MAC1]->half_duplex = + of_property_read_bool(eth1_node, "ti,half-duplex-capable"); prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; } |