linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: macb: do not copy the mac address if NULL
@ 2019-06-21 15:26 Antoine Tenart
  2019-06-24 15:55 ` Nicolas.Ferre
  2019-06-24 15:57 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Antoine Tenart @ 2019-06-21 15:26 UTC (permalink / raw)
  To: davem, nicolas.ferre
  Cc: Antoine Tenart, netdev, linux-kernel, ludovic.desroches,
	alexandre.belloni

This patch fixes the MAC address setup in the probe. The MAC address
retrieved using of_get_mac_address was checked for not containing an
error, but it may also be NULL which wasn't tested. Fix it by replacing
IS_ERR with IS_ERR_OR_NULL.

Fixes: 541ddc66d665 ("net: macb: support of_get_mac_address new ERR_PTR error")
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/cadence/macb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 1241a2a73438..1cd1f2c36d6f 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -4304,7 +4304,7 @@ static int macb_probe(struct platform_device *pdev)
 	if (PTR_ERR(mac) == -EPROBE_DEFER) {
 		err = -EPROBE_DEFER;
 		goto err_out_free_netdev;
-	} else if (!IS_ERR(mac)) {
+	} else if (!IS_ERR_OR_NULL(mac)) {
 		ether_addr_copy(bp->dev->dev_addr, mac);
 	} else {
 		macb_get_hwaddr(bp);
-- 
2.21.0


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

* Re: [PATCH net] net: macb: do not copy the mac address if NULL
  2019-06-21 15:26 [PATCH net] net: macb: do not copy the mac address if NULL Antoine Tenart
@ 2019-06-24 15:55 ` Nicolas.Ferre
  2019-06-24 15:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas.Ferre @ 2019-06-24 15:55 UTC (permalink / raw)
  To: antoine.tenart, davem
  Cc: netdev, linux-kernel, Ludovic.Desroches, alexandre.belloni

On 21/06/2019 at 17:26, Antoine Tenart wrote:
> This patch fixes the MAC address setup in the probe. The MAC address
> retrieved using of_get_mac_address was checked for not containing an
> error, but it may also be NULL which wasn't tested. Fix it by replacing
> IS_ERR with IS_ERR_OR_NULL.
> 
> Fixes: 541ddc66d665 ("net: macb: support of_get_mac_address new ERR_PTR error")
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com>

It could be good to have this fix for 5.2-final...

Thanks!

> ---
>   drivers/net/ethernet/cadence/macb_main.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 1241a2a73438..1cd1f2c36d6f 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -4304,7 +4304,7 @@ static int macb_probe(struct platform_device *pdev)
>   	if (PTR_ERR(mac) == -EPROBE_DEFER) {
>   		err = -EPROBE_DEFER;
>   		goto err_out_free_netdev;
> -	} else if (!IS_ERR(mac)) {
> +	} else if (!IS_ERR_OR_NULL(mac)) {
>   		ether_addr_copy(bp->dev->dev_addr, mac);
>   	} else {
>   		macb_get_hwaddr(bp);
> 


-- 
Nicolas Ferre

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

* Re: [PATCH net] net: macb: do not copy the mac address if NULL
  2019-06-21 15:26 [PATCH net] net: macb: do not copy the mac address if NULL Antoine Tenart
  2019-06-24 15:55 ` Nicolas.Ferre
@ 2019-06-24 15:57 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2019-06-24 15:57 UTC (permalink / raw)
  To: antoine.tenart
  Cc: nicolas.ferre, netdev, linux-kernel, ludovic.desroches,
	alexandre.belloni

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Fri, 21 Jun 2019 17:26:35 +0200

> This patch fixes the MAC address setup in the probe. The MAC address
> retrieved using of_get_mac_address was checked for not containing an
> error, but it may also be NULL which wasn't tested. Fix it by replacing
> IS_ERR with IS_ERR_OR_NULL.
> 
> Fixes: 541ddc66d665 ("net: macb: support of_get_mac_address new ERR_PTR error")
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied, thanks.


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

end of thread, other threads:[~2019-06-24 15:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-21 15:26 [PATCH net] net: macb: do not copy the mac address if NULL Antoine Tenart
2019-06-24 15:55 ` Nicolas.Ferre
2019-06-24 15:57 ` 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).