net: cpsw and mdio-gpio fixes for v3.15-final
Subsystems (6)
cover net: cpsw and mdio-gpio fixes for v3.15-final
These patches against v3.15-rc4 fix a few issues in the cpsw and mdio-gpio drivers.
Johan
Johan Hovold (5):
net: mdio-gpio: fix device-tree binding documentation
net: mdio-gpio: warn about missing bus alias id
Revert "net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver"
net: cpsw: fix null dereference at probe
net: cpsw: add missing of_node_put
Documentation/devicetree/bindings/net/mdio-gpio.txt | 2 +- drivers/net/ethernet/ti/cpsw.c | 17 ++++++----------- drivers/net/phy/mdio-gpio.c | 4 ++++ 3 files changed, 11 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.3.2
PATCH 1/5 net: mdio-gpio: fix device-tree binding documentation
Fix aliases syntax in device-tree binding example to avoid copy-paste errors (the alias would be dropped silently).
--- Documentation/devicetree/bindings/net/mdio-gpio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-gpio.txt +1 -1
@@ -14,7 +14,7 @@ node. Example: aliases { - mdio-gpio0 = <&mdio0>; + mdio-gpio0 = &mdio0; }; mdio0: mdio {
Signature · 6 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH 2/5 net: mdio-gpio: warn about missing bus alias id
In reply to Johan HovoldUse a sane default bus id (rather than -ENODEV) and print a warning when the bus alias id is missing.
--- drivers/net/phy/mdio-gpio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/phy/mdio-gpio.c +4 -0
@@ -215,6 +215,10 @@ static int mdio_gpio_probe(struct platform_device *pdev)if (pdev->dev.of_node) { pdata =mdio_gpio_of_get_data (pdev); bus_id =of_alias_get_id (pdev->dev.of_node,"mdio-gpio" ); +if (bus_id <0 ) { +dev_warn (&pdev->dev,"failed to get alias id\n" ); + bus_id =0 ; + } }else { pdata =dev_get_platdata (&pdev->dev); bus_id = pdev->id;
Signature · 1 line
1.8.3.2
PATCH 5/5 net: cpsw: add missing of_node_put
In reply to Johan HovoldAdd missing of_node_put to avoid kref leak.
--- drivers/net/ethernet/ti/cpsw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/cpsw.c +1 -0
@@ -1871,6 +1871,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, mdio_node =of_find_node_by_phandle (be32_to_cpup (parp)); phyid =be32_to_cpup (parp+1 ); mdio =of_find_device_by_node (mdio_node); +of_node_put (mdio_node);if (!mdio) {pr_err ("Missing mdio platform device\n" );return -EINVAL ;
Signature · 1 line
1.8.3.2
cover net: cpsw and mdio-gpio fixes for v3.15-final
In reply to Johan HovoldThese patches against v3.15-rc4 fix a few issues in the cpsw and mdio-gpio drivers.
Resend with proper stable CC (git send-email still fails to parse the #-part of the tag unless address is enclosed in <> it seems).
Sorry about the noise.
Johan
Johan Hovold (5):
net: mdio-gpio: fix device-tree binding documentation
net: mdio-gpio: warn about missing bus alias id
Revert "net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver"
net: cpsw: fix null dereference at probe
net: cpsw: add missing of_node_put
Documentation/devicetree/bindings/net/mdio-gpio.txt | 2 +- drivers/net/ethernet/ti/cpsw.c | 17 ++++++----------- drivers/net/phy/mdio-gpio.c | 4 ++++ 3 files changed, 11 insertions(+), 12 deletions(-)
Signature · 1 line
1.8.3.2
PATCH RESEND 1/5 net: mdio-gpio: fix device-tree binding documentation
Fix aliases syntax in device-tree binding example to avoid copy-paste errors (the alias would be dropped silently).
--- Documentation/devicetree/bindings/net/mdio-gpio.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/net/mdio-gpio.txt +1 -1
@@ -14,7 +14,7 @@ node. Example: aliases { - mdio-gpio0 = <&mdio0>; + mdio-gpio0 = &mdio0; }; mdio0: mdio {
Signature · 1 line
1.8.3.2
PATCH RESEND 2/5 net: mdio-gpio: warn about missing bus alias id
In reply to Johan HovoldUse a sane default bus id (rather than -ENODEV) and print a warning when the bus alias id is missing.
--- drivers/net/phy/mdio-gpio.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/phy/mdio-gpio.c +4 -0
@@ -215,6 +215,10 @@ static int mdio_gpio_probe(struct platform_device *pdev)if (pdev->dev.of_node) { pdata =mdio_gpio_of_get_data (pdev); bus_id =of_alias_get_id (pdev->dev.of_node,"mdio-gpio" ); +if (bus_id <0 ) { +dev_warn (&pdev->dev,"failed to get alias id\n" ); + bus_id =0 ; + } }else { pdata =dev_get_platdata (&pdev->dev); bus_id = pdev->id;
Signature · 1 line
1.8.3.2
PATCH RESEND 3/5 Revert "net: eth: cpsw: Correctly attach to GPIO bitbang MDIO driver"
In reply to Johan HovoldThis reverts commit f8d56d8f892be43a2404356073e16401eb5a42e6.
Fix potential null-pointer dereference at probe if the mdio-gpio device has not been successfully probed yet.
The offending commit is plain wrong for a number of reasons. First of all it accesses internal driver data of an unrelated device. Neither does it check that the data is non-null (which it is in case the device has not been probed yet).
Furthermore, the decision on whether to treat any driver data according to the mdio-gpio driver's internals is made based on the node name. But the name is not compared against "mdio" which is the normal name for the node, but rather against "gpio" which the node does not have to be named (and shouldn't be according to the binding documentation). [ If this hack is to be kept out-of-tree it should at least be matching against the compatible property. ]
--- drivers/net/ethernet/ti/cpsw.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
drivers/net/ethernet/ti/cpsw.c +2 -12
@@ -1871,18 +1871,8 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, mdio_node =of_find_node_by_phandle (be32_to_cpup (parp)); phyid =be32_to_cpup (parp+1 ); mdio =of_find_device_by_node (mdio_node); - -if (strncmp (mdio->name,"gpio" ,4 ) ==0 ) { -/* GPIO bitbang MDIO driver attached */ -struct mii_bus *bus =dev_get_drvdata (&mdio->dev); - -snprintf (slave_data->phy_id,sizeof (slave_data->phy_id), -PHY_ID_FMT , bus->id, phyid); - }else { -/* davinci MDIO driver attached */ -snprintf (slave_data->phy_id,sizeof (slave_data->phy_id), -PHY_ID_FMT , mdio->name, phyid); - } +snprintf (slave_data->phy_id,sizeof (slave_data->phy_id), +PHY_ID_FMT , mdio->name, phyid); mac_addr =of_get_mac_address (slave_node);if (mac_addr)
Signature · 1 line
1.8.3.2
PATCH RESEND 4/5 net: cpsw: fix null dereference at probe
In reply to Johan HovoldFix null-pointer dereference at probe when the mdio platform device is missing (e.g. when it has been disabled in DT).
--- drivers/net/ethernet/ti/cpsw.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/ti/cpsw.c +4 -0
@@ -1871,6 +1871,10 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, mdio_node =of_find_node_by_phandle (be32_to_cpup (parp)); phyid =be32_to_cpup (parp+1 ); mdio =of_find_device_by_node (mdio_node); +if (!mdio) { +pr_err ("Missing mdio platform device\n" ); +return -EINVAL ; + }snprintf (slave_data->phy_id,sizeof (slave_data->phy_id),PHY_ID_FMT , mdio->name, phyid);
Signature · 6 lines
1.8.3.2 -- To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH RESEND 5/5 net: cpsw: add missing of_node_put
In reply to Johan HovoldAdd missing of_node_put to avoid kref leak.
--- drivers/net/ethernet/ti/cpsw.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/ti/cpsw.c +1 -0
@@ -1871,6 +1871,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data, mdio_node =of_find_node_by_phandle (be32_to_cpup (parp)); phyid =be32_to_cpup (parp+1 ); mdio =of_find_device_by_node (mdio_node); +of_node_put (mdio_node);if (!mdio) {pr_err ("Missing mdio platform device\n" );return -EINVAL ;
Signature · 1 line
1.8.3.2
David Miller
maintainerFrom: Johan Hovold <[email protected]>
Date: Thu, 8 May 2014 10:09:19 +0200
Quoted 7 lines
These patches against v3.15-rc4 fix a few issues in the cpsw and mdio-gpio drivers.
Resend with proper stable CC (git send-email still fails to parse the #-part of the tag unless address is enclosed in <> it seems).
Sorry about the noise.
Series applied, thanks.