linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode
@ 2019-03-12  7:50 Kangjie Lu
  2019-03-12  8:07 ` Maxime Ripard
  2019-03-12 21:54 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Kangjie Lu @ 2019-03-12  7:50 UTC (permalink / raw)
  To: kjlu
  Cc: Alexandre Torgue, Maxime Ripard, netdev, linux-kernel,
	linux-stm32, Chen-Yu Tsai, Jose Abreu, Maxime Coquelin, pakki001,
	Giuseppe Cavallaro, David S. Miller, linux-arm-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 -EINVAL of it fails.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
index 0f660af01a4b..195669f550f0 100644
--- a/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
+++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-sun8i.c
@@ -1147,7 +1147,10 @@ static int sun8i_dwmac_probe(struct platform_device *pdev)
 		return ret;
 	}
 
-	plat_dat->interface = of_get_phy_mode(dev->of_node);
+	ret = of_get_phy_mode(dev->of_node);
+	if (ret < 0)
+		return -EINVAL;
+	plat_dat->interface = ret;
 
 	/* platform data specifying hardware features and callbacks.
 	 * hardware features were copied from Allwinner drivers.
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode
  2019-03-12  7:50 [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode Kangjie Lu
@ 2019-03-12  8:07 ` Maxime Ripard
  2019-03-12 21:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Maxime Ripard @ 2019-03-12  8:07 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: Alexandre Torgue, netdev, linux-kernel, linux-stm32, Chen-Yu Tsai,
	Jose Abreu, Maxime Coquelin, pakki001, Giuseppe Cavallaro,
	David S. Miller, linux-arm-kernel


[-- Attachment #1.1: Type: text/plain, Size: 426 bytes --]

On Tue, Mar 12, 2019 at 02:50:40AM -0500, Kangjie Lu wrote:
> 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 -EINVAL of it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Acked-by: Maxime Ripard <maxime.ripard@bootlin.com>

Thanks!
Maxime

-- 
Maxime Ripard, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode
  2019-03-12  7:50 [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode Kangjie Lu
  2019-03-12  8:07 ` Maxime Ripard
@ 2019-03-12 21:54 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-03-12 21:54 UTC (permalink / raw)
  To: kjlu
  Cc: alexandre.torgue, maxime.ripard, netdev, linux-kernel, wens,
	joabreu, mcoquelin.stm32, pakki001, peppe.cavallaro, linux-stm32,
	linux-arm-kernel

From: Kangjie Lu <kjlu@umn.edu>
Date: Tue, 12 Mar 2019 02:50:40 -0500

> 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 -EINVAL of it fails.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>

Applied.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2019-03-13 10:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-12  7:50 [PATCH] net: dwmac-sun8i: fix a missing check of of_get_phy_mode Kangjie Lu
2019-03-12  8:07 ` Maxime Ripard
2019-03-12 21:54 ` 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).