Skip to content

Commit 0b0e9cd

Browse files
robherringkuba-moo
authored andcommitted
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) <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 46e6acf commit 0b0e9cd

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

drivers/net/mdio/of_mdio.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -390,7 +390,7 @@ EXPORT_SYMBOL(of_phy_get_and_connect);
390390
bool of_phy_is_fixed_link(struct device_node *np)
391391
{
392392
struct device_node *dn;
393-
int len, err;
393+
int err;
394394
const char *managed;
395395

396396
/* New binding */
@@ -405,8 +405,7 @@ bool of_phy_is_fixed_link(struct device_node *np)
405405
return true;
406406

407407
/* 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)
410409
return true;
411410

412411
return false;

0 commit comments

Comments
 (0)