linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] net: renesas: fix a missing check of of_get_phy_mode
@ 2019-03-11  7:49 Kangjie Lu
  2019-03-11 10:29 ` Sergei Shtylyov
  2019-03-11 10:59 ` [PATCH v2] net: renesas: " Geert Uytterhoeven
  0 siblings, 2 replies; 12+ messages in thread
From: Kangjie Lu @ 2019-03-11  7:49 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Sergei Shtylyov, David S. Miller, Vladimir Zapolskiy,
	Geert Uytterhoeven, Simon Horman, Chris Brandt, netdev,
	linux-renesas-soc, linux-kernel

of_get_phy_mode may fail and return a negative error code;
the fix checks the return value of of_get_phy_mode and
returns NULL of it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/ethernet/renesas/sh_eth.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 339b2eae2100..239eeafe1b2d 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3187,6 +3187,8 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
 		return NULL;
 
 	pdata->phy_interface = of_get_phy_mode(np);
+	if (pdata->phy_interface < 0)
+		return NULL;
 
 	mac_addr = of_get_mac_address(np);
 	if (mac_addr)
-- 
2.17.1


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

end of thread, other threads:[~2019-03-12 21:51 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-11  7:49 [PATCH v2] net: renesas: fix a missing check of of_get_phy_mode Kangjie Lu
2019-03-11 10:29 ` Sergei Shtylyov
2019-03-11 17:52   ` David Miller
2019-03-11 17:55     ` Sergei Shtylyov
2019-03-12  6:30       ` [PATCH v2] net: sh_eth: " Kangjie Lu
2019-03-12  7:31         ` Sergei Shtylyov
2019-03-12  7:43           ` [PATCH v3] " Kangjie Lu
2019-03-12  7:50             ` Sergei Shtylyov
2019-03-12  8:18             ` Geert Uytterhoeven
2019-03-12 21:51             ` David Miller
2019-03-11 10:59 ` [PATCH v2] net: renesas: " Geert Uytterhoeven
2019-03-11 14:18   ` Sergei Shtylyov

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).