@@ -145,9 +145,6 @@ int mdio_mux_init(struct device *dev,cb=devm_kzalloc(dev,sizeof(*cb),GFP_KERNEL);if(!cb){-dev_err(dev,-"Error: Failed to allocate memory for child %pOF\n",-child_bus_node);ret_val=-ENOMEM;continue;}
@@ -156,9 +153,6 @@ int mdio_mux_init(struct device *dev,cb->mii_bus=mdiobus_alloc();if(!cb->mii_bus){-dev_err(dev,-"Error: Failed to allocate MDIO bus for child %pOF\n",-child_bus_node);ret_val=-ENOMEM;devm_kfree(dev,cb);continue;
mdio_mux_uninit() call put_device (unconditionally) because of
of_mdio_find_bus() in mdio_mux_init.
But of_mdio_find_bus is only called if mux_bus is empty.
If mux_bus is set, mdio_mux_uninit will print a "refcount_t: underflow"
trace.
This patch add a get_device in the other branch of "if (mux_bus)".
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/phy/mdio-mux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
@@ -117,6 +117,7 @@ int mdio_mux_init(struct device *dev,}else{parent_bus_node=NULL;parent_bus=mux_bus;+get_device(&parent_bus->dev);}pb=devm_kzalloc(dev,sizeof(*pb),GFP_KERNEL);
@@ -186,8 +187,7 @@ int mdio_mux_init(struct device *dev,devm_kfree(dev,pb);err_pb_kz:/* balance the reference of_mdio_find_bus() took */-if(!mux_bus)-put_device(&parent_bus->dev);+put_device(&parent_bus->dev);err_parent_bus:of_node_put(parent_bus_node);returnret_val;
This patch fix an old information that mdio-mux-mmioreg can only handle
8bit registers.
This is not true anymore.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/phy/Kconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Remove the driver version information because this information
is not useful in an upstream kernel driver.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
---
drivers/net/phy/mdio-mux.c | 1 -
1 file changed, 1 deletion(-)
@@ -120,7 +120,7 @@ int mdio_mux_init(struct device *dev,}pb=devm_kzalloc(dev,sizeof(*pb),GFP_KERNEL);-if(pb==NULL){+if(!pb){ret_val=-ENOMEM;gotoerr_pb_kz;}
@@ -144,7 +144,7 @@ int mdio_mux_init(struct device *dev,}cb=devm_kzalloc(dev,sizeof(*cb),GFP_KERNEL);-if(cb==NULL){+if(!cb){dev_err(dev,"Error: Failed to allocate memory for child %pOF\n",child_bus_node);
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-30 18:47:01
On Wed, Aug 30, 2017 at 07:46:49PM +0200, Corentin Labbe wrote:
Remove the driver version information because this information
is not useful in an upstream kernel driver.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Hi Corentin
You may as well remove DRV_VERSION from this file, not just here.
Andrew
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-30 18:49:43
On Wed, Aug 30, 2017 at 07:46:50PM +0200, Corentin Labbe wrote:
This patch fix an old information that mdio-mux-mmioreg can only handle
8bit registers.
This is not true anymore.
Signed-off-by: Corentin Labbe <clabbe.montjoie@gmail.com>
From: Andrew Lunn <andrew@lunn.ch> Date: 2017-08-30 19:01:23
On Wed, Aug 30, 2017 at 07:46:46PM +0200, Corentin Labbe wrote:
Hello
This patch series fix minor problems found when working on the
dwmac-sun8i syscon mdio-mux.
Hi Corentin
In general, a nice patchset.
Looking at the code, there are a few calls to devm_kfree() which look
redundant. This one should probably stay:
if (r) {
mdiobus_free(cb->mii_bus);
devm_kfree(dev, cb);
} else {
but i think the others can go.
Just a suggestion, not a problem if you don't feel like doing this...
Andrew
On Wed, Aug 30, 2017 at 09:01:19PM +0200, Andrew Lunn wrote:
On Wed, Aug 30, 2017 at 07:46:46PM +0200, Corentin Labbe wrote:
quoted
Hello
This patch series fix minor problems found when working on the
dwmac-sun8i syscon mdio-mux.
Hi Corentin
In geineral, a nice patchset.
Thanks, I will send a v2 with your suggestions.
Looking at the code, there are a few calls to devm_kfree() which look
redundant. This one should probably stay:
if (r) {
mdiobus_free(cb->mii_bus);
devm_kfree(dev, cb);
} else {
but i think the others can go.
Just a suggestion, not a problem if you don't feel like doing this...
I will try but in another serie. For letting more time for test.
Regards