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: mdio: Use of_property_count_u32_elems() to get property length

Replace of_get_property() with the type specific
of_property_count_u32_elems() to get the property length.

This is part of a larger effort to remove callers of of_get_property()
and similar functions. of_get_property() leaks the DT property data
pointer which is a problem for dynamically allocated nodes which may
be freed.

Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Link: https://patch.msgid.link/20240731201514.1839974-2-robh@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Rob Herring (Arm) and committed by
Jakub Kicinski
0b0e9cdb 46e6acfe

+2 -3
+2 -3
drivers/net/mdio/of_mdio.c
··· 390 390 bool of_phy_is_fixed_link(struct device_node *np) 391 391 { 392 392 struct device_node *dn; 393 - int len, err; 393 + int err; 394 394 const char *managed; 395 395 396 396 /* New binding */ ··· 405 405 return true; 406 406 407 407 /* Old binding */ 408 - if (of_get_property(np, "fixed-link", &len) && 409 - len == (5 * sizeof(__be32))) 408 + if (of_property_count_u32_elems(np, "fixed-link") == 5) 410 409 return true; 411 410 412 411 return false;