Skip to content

Commit cc0c92f

Browse files
nehebkuba-moo
authored andcommitted
net: ibm: emac: replace of_get_property
of_property_read_u32 can be used. Signed-off-by: Rosen Penev <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent baab9de commit cc0c92f

File tree

1 file changed

+9
-11
lines changed
  • drivers/net/ethernet/ibm/emac

1 file changed

+9
-11
lines changed

drivers/net/ethernet/ibm/emac/core.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2444,15 +2444,14 @@ static int emac_wait_deps(struct emac_instance *dev)
24442444
static int emac_read_uint_prop(struct device_node *np, const char *name,
24452445
u32 *val, int fatal)
24462446
{
2447-
int len;
2448-
const u32 *prop = of_get_property(np, name, &len);
2449-
if (prop == NULL || len < sizeof(u32)) {
2447+
int err;
2448+
2449+
err = of_property_read_u32(np, name, val);
2450+
if (err) {
24502451
if (fatal)
2451-
printk(KERN_ERR "%pOF: missing %s property\n",
2452-
np, name);
2453-
return -ENODEV;
2452+
pr_err("%pOF: missing %s property", np, name);
2453+
return err;
24542454
}
2455-
*val = *prop;
24562455
return 0;
24572456
}
24582457

@@ -3301,16 +3300,15 @@ static void __init emac_make_bootlist(void)
33013300

33023301
/* Collect EMACs */
33033302
while((np = of_find_all_nodes(np)) != NULL) {
3304-
const u32 *idx;
3303+
u32 idx;
33053304

33063305
if (of_match_node(emac_match, np) == NULL)
33073306
continue;
33083307
if (of_property_read_bool(np, "unused"))
33093308
continue;
3310-
idx = of_get_property(np, "cell-index", NULL);
3311-
if (idx == NULL)
3309+
if (of_property_read_u32(np, "cell-index", &idx))
33123310
continue;
3313-
cell_indices[i] = *idx;
3311+
cell_indices[i] = idx;
33143312
emac_boot_list[i++] = of_node_get(np);
33153313
if (i >= EMAC_BOOT_LIST_SIZE) {
33163314
of_node_put(np);

0 commit comments

Comments
 (0)