Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Rob Herring (Arm) and committed by
Jakub Kicinski
5fe164fb 0b0e9cdb

+12 -12
+3 -3
drivers/net/ethernet/freescale/fman/fman_port.c
··· 1748 1748 struct resource res; 1749 1749 struct resource *dev_res; 1750 1750 u32 val; 1751 - int err = 0, lenp; 1751 + int err = 0; 1752 1752 enum fman_port_type port_type; 1753 1753 u16 port_speed; 1754 1754 u8 port_id; ··· 1795 1795 if (of_device_is_compatible(port_node, "fsl,fman-v3-port-tx")) { 1796 1796 port_type = FMAN_PORT_TYPE_TX; 1797 1797 port_speed = 1000; 1798 - if (of_find_property(port_node, "fsl,fman-10g-port", &lenp)) 1798 + if (of_property_read_bool(port_node, "fsl,fman-10g-port")) 1799 1799 port_speed = 10000; 1800 1800 1801 1801 } else if (of_device_is_compatible(port_node, "fsl,fman-v2-port-tx")) { ··· 1808 1808 } else if (of_device_is_compatible(port_node, "fsl,fman-v3-port-rx")) { 1809 1809 port_type = FMAN_PORT_TYPE_RX; 1810 1810 port_speed = 1000; 1811 - if (of_find_property(port_node, "fsl,fman-10g-port", &lenp)) 1811 + if (of_property_read_bool(port_node, "fsl,fman-10g-port")) 1812 1812 port_speed = 10000; 1813 1813 1814 1814 } else if (of_device_is_compatible(port_node, "fsl,fman-v2-port-rx")) {
+4 -4
drivers/net/ethernet/ti/icssg/icssg_prueth.c
··· 1271 1271 goto exit_iep; 1272 1272 } 1273 1273 1274 - if (of_find_property(eth0_node, "ti,half-duplex-capable", NULL)) 1275 - prueth->emac[PRUETH_MAC0]->half_duplex = 1; 1274 + prueth->emac[PRUETH_MAC0]->half_duplex = 1275 + of_property_read_bool(eth0_node, "ti,half-duplex-capable"); 1276 1276 1277 1277 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; 1278 1278 } ··· 1285 1285 goto netdev_exit; 1286 1286 } 1287 1287 1288 - if (of_find_property(eth1_node, "ti,half-duplex-capable", NULL)) 1289 - prueth->emac[PRUETH_MAC1]->half_duplex = 1; 1288 + prueth->emac[PRUETH_MAC1]->half_duplex = 1289 + of_property_read_bool(eth1_node, "ti,half-duplex-capable"); 1290 1290 1291 1291 prueth->emac[PRUETH_MAC1]->iep = prueth->iep0; 1292 1292 }
+4 -4
drivers/net/ethernet/ti/icssg/icssg_prueth_sr1.c
··· 1045 1045 goto exit_iep; 1046 1046 } 1047 1047 1048 - if (of_find_property(eth0_node, "ti,half-duplex-capable", NULL)) 1049 - prueth->emac[PRUETH_MAC0]->half_duplex = 1; 1048 + prueth->emac[PRUETH_MAC0]->half_duplex = 1049 + of_property_read_bool(eth0_node, "ti,half-duplex-capable"); 1050 1050 1051 1051 prueth->emac[PRUETH_MAC0]->iep = prueth->iep0; 1052 1052 } ··· 1059 1059 goto netdev_exit; 1060 1060 } 1061 1061 1062 - if (of_find_property(eth1_node, "ti,half-duplex-capable", NULL)) 1063 - prueth->emac[PRUETH_MAC1]->half_duplex = 1; 1062 + prueth->emac[PRUETH_MAC1]->half_duplex = 1063 + of_property_read_bool(eth1_node, "ti,half-duplex-capable"); 1064 1064 1065 1065 prueth->emac[PRUETH_MAC1]->iep = prueth->iep1; 1066 1066 }
+1 -1
drivers/net/ethernet/xilinx/xilinx_axienet_main.c
··· 2396 2396 goto cleanup_clk; 2397 2397 } 2398 2398 2399 - if (!of_find_property(pdev->dev.of_node, "dmas", NULL)) { 2399 + if (!of_property_present(pdev->dev.of_node, "dmas")) { 2400 2400 /* Find the DMA node, map the DMA registers, and decode the DMA IRQs */ 2401 2401 np = of_parse_phandle(pdev->dev.of_node, "axistream-connected", 0); 2402 2402