# Re: \[PATCH 1/7\] phy: fix of\_mdio\_find\_bus() device refcount leak

- From: David Miller \<hidden\>
- Date: 2015-09-21 22:08:31 
- List: linuxppc-dev
- Page: https://ratatoskr.run/linuxppc-dev/2015/09/4580592
- Thread: https://ratatoskr.run/linux-devicetree/2015/09/4578516/t.md

```text
From: Russell King - ARM Linux <redacted>
Date: Mon, 21 Sep 2015 20:32:07 +0100

> In the case of the mdio mux code, I'm dropping the reference when
> either (a) we've encountered an error during initialisation and
> we're cleaning up, or (b) when the mdio mux code is being torn down
> after the mdiomux bus has been unregistered and freed.  In both
> cases, we're done with the mdio bus that was returned from
> of_mdio_find_bus().
> 
> In case (a), the devres code will release the kmalloc'd memory when
> mdio_mux_gpio_probe() or mdio_mux_mmioreg_probe() propagates the error
> out of their probe() function.
> 
> I'm not sure why you think anything is wrong here - maybe it's the odd
> code structure to the success path at the bottom of mdio_mux_init()?

Ok I may have misread your change.  I'll restudy it when you respin
the series with the commit message fixed and the DSA change added.

Thanks.
```
