Commit abd21a87 authored by David S. Miller's avatar David S. Miller

Merge branch 'mdio-mux-Misc-fix'

Corentin Labbe says:

====================
net: mdio-mux: Misc fix

This patch series fix minor problems found when working on the
dwmac-sun8i syscon mdio-mux.

Changes since v1:
- Removed obsolete comment about of_mdio_find_bus/put_device
- removed more DRV_VERSION
====================
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents c5b2cef3 60f78652
......@@ -85,7 +85,7 @@ config MDIO_BUS_MUX_MMIOREG
parent bus. Child bus selection is under the control of one of
the FPGA's registers.
Currently, only 8-bit registers are supported.
Currently, only 8/16/32 bits registers are supported.
config MDIO_CAVIUM
tristate
......
......@@ -13,7 +13,6 @@
#include <linux/module.h>
#include <linux/phy.h>
#define DRV_VERSION "1.0"
#define DRV_DESCRIPTION "MDIO bus multiplexer driver"
struct mdio_mux_child_bus;
......@@ -117,10 +116,11 @@ 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);
if (pb == NULL) {
if (!pb) {
ret_val = -ENOMEM;
goto err_pb_kz;
}
......@@ -144,10 +144,7 @@ int mdio_mux_init(struct device *dev,
}
cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL);
if (cb == NULL) {
dev_err(dev,
"Error: Failed to allocate memory for child %pOF\n",
child_bus_node);
if (!cb) {
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;
......@@ -185,16 +179,13 @@ int mdio_mux_init(struct device *dev,
}
if (pb->children) {
*mux_handle = pb;
dev_info(dev, "Version " DRV_VERSION "\n");
return 0;
}
dev_err(dev, "Error: No acceptable child buses found\n");
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);
return ret_val;
......@@ -212,12 +203,10 @@ void mdio_mux_uninit(void *mux_handle)
cb = cb->next;
}
/* balance the reference of_mdio_find_bus() in mdio_mux_init() took */
put_device(&pb->mii_bus->dev);
}
EXPORT_SYMBOL_GPL(mdio_mux_uninit);
MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_VERSION(DRV_VERSION);
MODULE_AUTHOR("David Daney");
MODULE_LICENSE("GPL");
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment