* [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
@ 2016-08-20 15:26 Wei Yongjun
2016-08-20 17:36 ` Andrew Lunn
2016-08-21 22:46 ` [PATCH -next v2] " Wei Yongjun
0 siblings, 2 replies; 6+ messages in thread
From: Wei Yongjun @ 2016-08-20 15:26 UTC (permalink / raw)
To: f.fainelli, michal.simek, soren.brinkmann
Cc: netdev, Wei Yongjun, linux-arm-kernel
This node pointer is returned by of_parse_phandle() with
refcount incremented in this function. of_node_put() on it
before exitting this function.
This is detected by Coccinelle semantic patch.
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index cad6e19..4f05e5e 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -75,6 +75,7 @@ int xgmiitorgmii_probe(struct mdio_device *mdiodev)
priv->phy_dev = of_phy_find_device(phy_node);
if (!priv->phy_dev) {
dev_info(dev, "Couldn't find phydev\n");
+ of_node_put(phy_node);
return -EPROBE_DEFER;
}
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
2016-08-20 15:26 [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe() Wei Yongjun
@ 2016-08-20 17:36 ` Andrew Lunn
2016-08-21 22:29 ` David Miller
2016-08-21 22:46 ` [PATCH -next v2] " Wei Yongjun
1 sibling, 1 reply; 6+ messages in thread
From: Andrew Lunn @ 2016-08-20 17:36 UTC (permalink / raw)
To: Wei Yongjun
Cc: f.fainelli, michal.simek, soren.brinkmann, netdev,
linux-arm-kernel
On Sat, Aug 20, 2016 at 03:26:55PM +0000, Wei Yongjun wrote:
> This node pointer is returned by of_parse_phandle() with
> refcount incremented in this function. of_node_put() on it
> before exitting this function.
Hi Wei
You are only releasing on the error path. What about the successful
path?
Andrew
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
> ---
> drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
> index cad6e19..4f05e5e 100644
> --- a/drivers/net/phy/xilinx_gmii2rgmii.c
> +++ b/drivers/net/phy/xilinx_gmii2rgmii.c
> @@ -75,6 +75,7 @@ int xgmiitorgmii_probe(struct mdio_device *mdiodev)
> priv->phy_dev = of_phy_find_device(phy_node);
> if (!priv->phy_dev) {
> dev_info(dev, "Couldn't find phydev\n");
> + of_node_put(phy_node);
> return -EPROBE_DEFER;
> }
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
2016-08-20 17:36 ` Andrew Lunn
@ 2016-08-21 22:29 ` David Miller
0 siblings, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-21 22:29 UTC (permalink / raw)
To: andrew
Cc: weiyj.lk, f.fainelli, michal.simek, soren.brinkmann, netdev,
linux-arm-kernel
From: Andrew Lunn <andrew@lunn.ch>
Date: Sat, 20 Aug 2016 19:36:05 +0200
> On Sat, Aug 20, 2016 at 03:26:55PM +0000, Wei Yongjun wrote:
>> This node pointer is returned by of_parse_phandle() with
>> refcount incremented in this function. of_node_put() on it
>> before exitting this function.
>
> Hi Wei
>
> You are only releasing on the error path. What about the successful
> path?
Agreed, as far as I can tell we do need to release it unconditionally
here.
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH -next v2] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
2016-08-20 15:26 [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe() Wei Yongjun
2016-08-20 17:36 ` Andrew Lunn
@ 2016-08-21 22:46 ` Wei Yongjun
2016-08-22 14:10 ` Kedari Appana
2016-08-23 1:08 ` David Miller
1 sibling, 2 replies; 6+ messages in thread
From: Wei Yongjun @ 2016-08-21 22:46 UTC (permalink / raw)
To: f.fainelli, michal.simek, soren.brinkmann, Andrew Lunn,
David Miller
Cc: netdev, Wei Yongjun, linux-arm-kernel
This node pointer is returned by of_parse_phandle() with
refcount incremented in this function. of_node_put() on it
before exitting this function.
This is detected by Coccinelle semantic patch.
Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
---
v1 -> v2: release it unconditionally as Andrew and David's suggestion
---
drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
index cad6e19..73b50f3 100644
--- a/drivers/net/phy/xilinx_gmii2rgmii.c
+++ b/drivers/net/phy/xilinx_gmii2rgmii.c
@@ -73,6 +73,7 @@ int xgmiitorgmii_probe(struct mdio_device *mdiodev)
}
priv->phy_dev = of_phy_find_device(phy_node);
+ of_node_put(phy_node);
if (!priv->phy_dev) {
dev_info(dev, "Couldn't find phydev\n");
return -EPROBE_DEFER;
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH -next v2] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
2016-08-21 22:46 ` [PATCH -next v2] " Wei Yongjun
@ 2016-08-22 14:10 ` Kedari Appana
2016-08-23 1:08 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: Kedari Appana @ 2016-08-22 14:10 UTC (permalink / raw)
To: Wei Yongjun
Cc: f.fainelli, michal.simek, soren.brinkmann, Andrew Lunn,
David Miller, netdev, linux-arm-kernel
Hi ,
On Mon, Aug 22, 2016 at 4:16 AM, Wei Yongjun <weiyj.lk@gmail.com> wrote:
> This node pointer is returned by of_parse_phandle() with
> refcount incremented in this function. of_node_put() on it
> before exitting this function.
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Reviewed-by: Kedareswara rao Appana <appanad@xilinx.com>
Thanks,
Kedar.
> ---
> v1 -> v2: release it unconditionally as Andrew and David's suggestion
> ---
> drivers/net/phy/xilinx_gmii2rgmii.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/net/phy/xilinx_gmii2rgmii.c b/drivers/net/phy/xilinx_gmii2rgmii.c
> index cad6e19..73b50f3 100644
> --- a/drivers/net/phy/xilinx_gmii2rgmii.c
> +++ b/drivers/net/phy/xilinx_gmii2rgmii.c
> @@ -73,6 +73,7 @@ int xgmiitorgmii_probe(struct mdio_device *mdiodev)
> }
>
> priv->phy_dev = of_phy_find_device(phy_node);
> + of_node_put(phy_node);
> if (!priv->phy_dev) {
> dev_info(dev, "Couldn't find phydev\n");
> return -EPROBE_DEFER;
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH -next v2] net: phy: Add missing of_node_put() in xgmiitorgmii_probe()
2016-08-21 22:46 ` [PATCH -next v2] " Wei Yongjun
2016-08-22 14:10 ` Kedari Appana
@ 2016-08-23 1:08 ` David Miller
1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2016-08-23 1:08 UTC (permalink / raw)
To: weiyj.lk
Cc: f.fainelli, michal.simek, soren.brinkmann, andrew, netdev,
linux-arm-kernel
From: Wei Yongjun <weiyj.lk@gmail.com>
Date: Sun, 21 Aug 2016 22:46:15 +0000
> This node pointer is returned by of_parse_phandle() with
> refcount incremented in this function. of_node_put() on it
> before exitting this function.
>
> This is detected by Coccinelle semantic patch.
>
> Signed-off-by: Wei Yongjun <weiyj.lk@gmail.com>
Applied.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2016-08-23 1:08 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-20 15:26 [PATCH -next] net: phy: Add missing of_node_put() in xgmiitorgmii_probe() Wei Yongjun
2016-08-20 17:36 ` Andrew Lunn
2016-08-21 22:29 ` David Miller
2016-08-21 22:46 ` [PATCH -next v2] " Wei Yongjun
2016-08-22 14:10 ` Kedari Appana
2016-08-23 1:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).