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 ...@@ -85,7 +85,7 @@ config MDIO_BUS_MUX_MMIOREG
parent bus. Child bus selection is under the control of one of parent bus. Child bus selection is under the control of one of
the FPGA's registers. the FPGA's registers.
Currently, only 8-bit registers are supported. Currently, only 8/16/32 bits registers are supported.
config MDIO_CAVIUM config MDIO_CAVIUM
tristate tristate
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/phy.h> #include <linux/phy.h>
#define DRV_VERSION "1.0"
#define DRV_DESCRIPTION "MDIO bus multiplexer driver" #define DRV_DESCRIPTION "MDIO bus multiplexer driver"
struct mdio_mux_child_bus; struct mdio_mux_child_bus;
...@@ -117,10 +116,11 @@ int mdio_mux_init(struct device *dev, ...@@ -117,10 +116,11 @@ int mdio_mux_init(struct device *dev,
} else { } else {
parent_bus_node = NULL; parent_bus_node = NULL;
parent_bus = mux_bus; parent_bus = mux_bus;
get_device(&parent_bus->dev);
} }
pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL); pb = devm_kzalloc(dev, sizeof(*pb), GFP_KERNEL);
if (pb == NULL) { if (!pb) {
ret_val = -ENOMEM; ret_val = -ENOMEM;
goto err_pb_kz; goto err_pb_kz;
} }
...@@ -144,10 +144,7 @@ int mdio_mux_init(struct device *dev, ...@@ -144,10 +144,7 @@ int mdio_mux_init(struct device *dev,
} }
cb = devm_kzalloc(dev, sizeof(*cb), GFP_KERNEL); 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);
ret_val = -ENOMEM; ret_val = -ENOMEM;
continue; continue;
} }
...@@ -156,9 +153,6 @@ int mdio_mux_init(struct device *dev, ...@@ -156,9 +153,6 @@ int mdio_mux_init(struct device *dev,
cb->mii_bus = mdiobus_alloc(); cb->mii_bus = mdiobus_alloc();
if (!cb->mii_bus) { if (!cb->mii_bus) {
dev_err(dev,
"Error: Failed to allocate MDIO bus for child %pOF\n",
child_bus_node);
ret_val = -ENOMEM; ret_val = -ENOMEM;
devm_kfree(dev, cb); devm_kfree(dev, cb);
continue; continue;
...@@ -185,15 +179,12 @@ int mdio_mux_init(struct device *dev, ...@@ -185,15 +179,12 @@ int mdio_mux_init(struct device *dev,
} }
if (pb->children) { if (pb->children) {
*mux_handle = pb; *mux_handle = pb;
dev_info(dev, "Version " DRV_VERSION "\n");
return 0; return 0;
} }
dev_err(dev, "Error: No acceptable child buses found\n"); dev_err(dev, "Error: No acceptable child buses found\n");
devm_kfree(dev, pb); devm_kfree(dev, pb);
err_pb_kz: 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: err_parent_bus:
of_node_put(parent_bus_node); of_node_put(parent_bus_node);
...@@ -212,12 +203,10 @@ void mdio_mux_uninit(void *mux_handle) ...@@ -212,12 +203,10 @@ void mdio_mux_uninit(void *mux_handle)
cb = cb->next; cb = cb->next;
} }
/* balance the reference of_mdio_find_bus() in mdio_mux_init() took */
put_device(&pb->mii_bus->dev); put_device(&pb->mii_bus->dev);
} }
EXPORT_SYMBOL_GPL(mdio_mux_uninit); EXPORT_SYMBOL_GPL(mdio_mux_uninit);
MODULE_DESCRIPTION(DRV_DESCRIPTION); MODULE_DESCRIPTION(DRV_DESCRIPTION);
MODULE_VERSION(DRV_VERSION);
MODULE_AUTHOR("David Daney"); MODULE_AUTHOR("David Daney");
MODULE_LICENSE("GPL"); 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