From 6f2c9bd85eee30fd77e6c65c097769ad0d6d7352 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Uwe=20Kleine-K=C3=B6nig?= Date: Thu, 7 Aug 2014 22:17:07 +0200 Subject: [PATCH] net: gianfar: fix reference counting for phy_node MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The line before the changed if condition is: priv->phy_node = of_parse_phandle(np, "phy-handle", 0); . If this call succeeds priv->phy_node must not be overwritten in the if block; otherwise the reference to the node returned by of_parse_phandle is lost. So add a check that the if block isn't executed in this case. Furthermore in the fixed phy case no reference is aquired for phy_node resulting in an of_node_put without holding a reference. To fix that, get a reference on the MAC dt node. Fixes: be40364544bd ("gianfar: use the new fixed PHY helpers") Signed-off-by: Uwe Kleine-König Signed-off-by: David S. Miller --- Reading git-format-patch failed