Merge branch 'net_of_node_put'
Julia Lawall says: ==================== add missing of_node_put The various for_each device_node iterators performs an of_node_get on each iteration, so a break out of the loop requires an of_node_put. The complete semantic patch that fixes this problem is (http://coccinelle.lip6.fr): // <smpl> @r@ local idexpression n; expression e1,e2; iterator name for_each_node_by_name, for_each_node_by_type, for_each_compatible_node, for_each_matching_node, for_each_matching_node_and_match, for_each_child_of_node, for_each_available_child_of_node, for_each_node_with_property; iterator i; statement S; expression list [n1] es; @@ ( ( for_each_node_by_name(n,e1) S | for_each_node_by_type(n,e1) S | for_each_compatible_node(n,e1,e2) S | for_each_matching_node(n,e1) S | for_each_matching_node_and_match(n,e1,e2) S | for_each_child_of_node(e1,n) S | for_each_available_child_of_node(e1,n) S | for_each_node_with_property(n,e1) S ) & i(es,n,...) S ) @@ local idexpression r.n; iterator r.i; expression e; expression list [r.n1] es; @@ i(es,n,...) { ... ( of_node_put(n); | e = n | return n; | + of_node_put(n); ? return ...; ) ... } @@ local idexpression r.n; iterator r.i; expression e; expression list [r.n1] es; @@ i(es,n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? break; ) ... } ... when != n @@ local idexpression r.n; iterator r.i; expression e; identifier l; expression list [r.n1] es; @@ i(es,n,...) { ... ( of_node_put(n); | e = n | + of_node_put(n); ? goto l; ) ... } ... l: ... when != n// </smpl> ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
8fe012964a
6 changed files with 16 additions and 4 deletions
|
@ -977,8 +977,10 @@ static int bgx_init_of_phy(struct bgx *bgx)
|
|||
SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev);
|
||||
bgx->lmac[lmac].lmacid = lmac;
|
||||
lmac++;
|
||||
if (lmac == MAX_LMAC_PER_BGX)
|
||||
if (lmac == MAX_LMAC_PER_BGX) {
|
||||
of_node_put(np_child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2817,8 +2817,10 @@ static int mv643xx_eth_shared_of_probe(struct platform_device *pdev)
|
|||
|
||||
for_each_available_child_of_node(np, pnp) {
|
||||
ret = mv643xx_eth_shared_of_add_port(pdev, pnp);
|
||||
if (ret)
|
||||
if (ret) {
|
||||
of_node_put(pnp);
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -2637,8 +2637,10 @@ static void init_secondary_ports(struct gbe_priv *gbe_dev,
|
|||
mac_phy_link = true;
|
||||
|
||||
slave->open = true;
|
||||
if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves)
|
||||
if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves) {
|
||||
of_node_put(port);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* of_phy_connect() is needed only for MAC-PHY interface */
|
||||
|
@ -3137,8 +3139,10 @@ static int gbe_probe(struct netcp_device *netcp_device, struct device *dev,
|
|||
continue;
|
||||
}
|
||||
gbe_dev->num_slaves++;
|
||||
if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves)
|
||||
if (gbe_dev->num_slaves >= gbe_dev->max_num_slaves) {
|
||||
of_node_put(interface);
|
||||
break;
|
||||
}
|
||||
}
|
||||
of_node_put(interfaces);
|
||||
|
||||
|
|
|
@ -113,12 +113,14 @@ static int mdio_mux_mmioreg_probe(struct platform_device *pdev)
|
|||
if (!iprop || len != sizeof(uint32_t)) {
|
||||
dev_err(&pdev->dev, "mdio-mux child node %s is "
|
||||
"missing a 'reg' property\n", np2->full_name);
|
||||
of_node_put(np2);
|
||||
return -ENODEV;
|
||||
}
|
||||
if (be32_to_cpup(iprop) & ~s->mask) {
|
||||
dev_err(&pdev->dev, "mdio-mux child node %s has "
|
||||
"a 'reg' value with unmasked bits\n",
|
||||
np2->full_name);
|
||||
of_node_put(np2);
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -144,6 +144,7 @@ int mdio_mux_init(struct device *dev,
|
|||
dev_err(dev,
|
||||
"Error: Failed to allocate memory for child\n");
|
||||
ret_val = -ENOMEM;
|
||||
of_node_put(child_bus_node);
|
||||
break;
|
||||
}
|
||||
cb->bus_number = v;
|
||||
|
|
|
@ -715,6 +715,7 @@ static bool check_device_tree(struct ath6kl *ar)
|
|||
board_filename, ret);
|
||||
continue;
|
||||
}
|
||||
of_node_put(node);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
Loading…
Reference in a new issue