Skip to content

Commit

Permalink
niu: read property length only if we use it
Browse files Browse the repository at this point in the history
In three places, the driver calls of_get_property and reads the property
length although the length is not used. Update the calls to not request
the length.

Signed-off-by: Martin Kaiser <martin@kaiser.cx>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Martin Kaiser authored and David S. Miller committed Aug 2, 2021
1 parent d39e8b9 commit 451395f
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/net/ethernet/sun/niu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9208,7 +9208,7 @@ static int niu_get_of_props(struct niu *np)
else
dp = pci_device_to_OF_node(np->pdev);

phy_type = of_get_property(dp, "phy-type", &prop_len);
phy_type = of_get_property(dp, "phy-type", NULL);
if (!phy_type) {
netdev_err(dev, "%pOF: OF node lacks phy-type property\n", dp);
return -EINVAL;
Expand Down Expand Up @@ -9242,12 +9242,12 @@ static int niu_get_of_props(struct niu *np)
return -EINVAL;
}

model = of_get_property(dp, "model", &prop_len);
model = of_get_property(dp, "model", NULL);

if (model)
strcpy(np->vpd.model, model);

if (of_find_property(dp, "hot-swappable-phy", &prop_len)) {
if (of_find_property(dp, "hot-swappable-phy", NULL)) {
np->flags |= (NIU_FLAGS_10G | NIU_FLAGS_FIBER |
NIU_FLAGS_HOTPLUG_PHY);
}
Expand Down

0 comments on commit 451395f

Please sign in to comment.