netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error
@ 2014-02-12 22:33 Uwe Kleine-König
  2014-02-13 14:11 ` Mugunthan V N
  2014-02-13 23:26 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2014-02-12 22:33 UTC (permalink / raw)
  To: netdev; +Cc: kernel, Mugunthan V N, David S. Miller

It's wrong if the device tree doesn't provide a phy-mode property for
the cpsw slaves as it is documented to be required in
Documentation/devicetree/bindings/net/cpsw.txt.

Anyhow it's nice to catch that problem, still more as it used to work
without this property up to commit 388367a5a9fb (drivers: net: cpsw: use
cpsw-phy-sel driver to configure phy mode) which is in v3.13-rc1.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
 drivers/net/ethernet/ti/cpsw.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 1d860ce914ed..542c5114851c 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -1896,6 +1896,11 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 			memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
 
 		slave_data->phy_if = of_get_phy_mode(slave_node);
+		if (slave_data->phy_if < 0) {
+			pr_err("Missing or malformed slave[%d] phy-mode property\n",
+			       i);
+			return slave_data->phy_if;
+		}
 
 		if (data->dual_emac) {
 			if (of_property_read_u32(slave_node, "dual_emac_res_vlan",
-- 
1.8.5.3

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error
  2014-02-12 22:33 [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error Uwe Kleine-König
@ 2014-02-13 14:11 ` Mugunthan V N
  2014-02-13 23:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Mugunthan V N @ 2014-02-13 14:11 UTC (permalink / raw)
  To: Uwe Kleine-König, netdev; +Cc: kernel, David S. Miller

On Thursday 13 February 2014 04:03 AM, Uwe Kleine-König wrote:
> It's wrong if the device tree doesn't provide a phy-mode property for
> the cpsw slaves as it is documented to be required in
> Documentation/devicetree/bindings/net/cpsw.txt.
>
> Anyhow it's nice to catch that problem, still more as it used to work
> without this property up to commit 388367a5a9fb (drivers: net: cpsw: use
> cpsw-phy-sel driver to configure phy mode) which is in v3.13-rc1.
>
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Good catch

Acked-by: Mugunthan V N <mugunthanvnm@ti.com>

Regards
Mugunthan V N

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error
  2014-02-12 22:33 [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error Uwe Kleine-König
  2014-02-13 14:11 ` Mugunthan V N
@ 2014-02-13 23:26 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2014-02-13 23:26 UTC (permalink / raw)
  To: u.kleine-koenig; +Cc: netdev, kernel, mugunthanvnm

From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Date: Wed, 12 Feb 2014 23:33:22 +0100

> It's wrong if the device tree doesn't provide a phy-mode property for
> the cpsw slaves as it is documented to be required in
> Documentation/devicetree/bindings/net/cpsw.txt.
> 
> Anyhow it's nice to catch that problem, still more as it used to work
> without this property up to commit 388367a5a9fb (drivers: net: cpsw: use
> cpsw-phy-sel driver to configure phy mode) which is in v3.13-rc1.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>

Applied, thanks.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-02-13 23:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-02-12 22:33 [PATCH] net: cpsw: catch of_get_phy_mode failing and propagate error Uwe Kleine-König
2014-02-13 14:11 ` Mugunthan V N
2014-02-13 23:26 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).