All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-06 21:24 ` Petr Štetiar
  0 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Matthias Brugger
  Cc: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Frank Rowand,
	devel, linux-kernel, Greg Kroah-Hartman, Maxime Ripard,
	Petr Štetiar, linux-arm-kernel, linux-mediatek

Hi,

this patch series is an attempt to fix the mess, I've somehow managed to
introduce.

First patch in this series is defacto v5 of the previous 05/10 patch in the
series, but since the v4 of this 05/10 patch wasn't picked up by the
patchwork for some unknown reason, this patch wasn't applied with the other
9 patches in the series, so I'm resending it as a separate patch of this
fixup series again.

Second patch is a result of this rebase against net-next tree, where I was
checking again all current users of of_get_mac_address and found out, that
there's new one in DSA, so I've converted this user to the new ERR_PTR
encoded error value as well.

Third patch which was sent as v5 wasn't considered for merge, but I still
think, that we need to check for possible NULL value, thus current IS_ERR
check isn't sufficient and we need to use IS_ERR_OR_NULL instead.

Fourth patch fixes warning reported by kbuild test robot.

Cheers,

Petr

Petr Štetiar (4):
  net: ethernet: support of_get_mac_address new ERR_PTR error
  net: dsa: support of_get_mac_address new ERR_PTR error
  staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
  net: usb: smsc: fix warning reported by kbuild test robot

 drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/ethoc.c                          | 2 +-
 drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
 drivers/net/ethernet/freescale/fec_main.c             | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
 drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
 drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
 drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
 drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 drivers/net/usb/smsc75xx.c                            | 2 +-
 drivers/net/usb/smsc95xx.c                            | 2 +-
 drivers/staging/octeon/ethernet.c                     | 2 +-
 net/dsa/slave.c                                       | 2 +-
 net/ethernet/eth.c                                    | 2 +-
 49 files changed, 49 insertions(+), 49 deletions(-)

-- 
1.9.1


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

* [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-06 21:24 ` Petr Štetiar
  0 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Matthias Brugger
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard,
	Greg Kroah-Hartman, linux-kernel, linux-mediatek,
	Petr Štetiar, Frank Rowand, linux-arm-kernel,
	Heiner Kallweit

Hi,

this patch series is an attempt to fix the mess, I've somehow managed to
introduce.

First patch in this series is defacto v5 of the previous 05/10 patch in the
series, but since the v4 of this 05/10 patch wasn't picked up by the
patchwork for some unknown reason, this patch wasn't applied with the other
9 patches in the series, so I'm resending it as a separate patch of this
fixup series again.

Second patch is a result of this rebase against net-next tree, where I was
checking again all current users of of_get_mac_address and found out, that
there's new one in DSA, so I've converted this user to the new ERR_PTR
encoded error value as well.

Third patch which was sent as v5 wasn't considered for merge, but I still
think, that we need to check for possible NULL value, thus current IS_ERR
check isn't sufficient and we need to use IS_ERR_OR_NULL instead.

Fourth patch fixes warning reported by kbuild test robot.

Cheers,

Petr

Petr Štetiar (4):
  net: ethernet: support of_get_mac_address new ERR_PTR error
  net: dsa: support of_get_mac_address new ERR_PTR error
  staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
  net: usb: smsc: fix warning reported by kbuild test robot

 drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/ethoc.c                          | 2 +-
 drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
 drivers/net/ethernet/freescale/fec_main.c             | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
 drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
 drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
 drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
 drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 drivers/net/usb/smsc75xx.c                            | 2 +-
 drivers/net/usb/smsc95xx.c                            | 2 +-
 drivers/staging/octeon/ethernet.c                     | 2 +-
 net/dsa/slave.c                                       | 2 +-
 net/ethernet/eth.c                                    | 2 +-
 49 files changed, 49 insertions(+), 49 deletions(-)

-- 
1.9.1


_______________________________________________
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] 29+ messages in thread

* [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error
  2019-05-06 21:24 ` Petr Štetiar
@ 2019-05-06 21:24   ` Petr Štetiar
  -1 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Andreas Larsson, Maxime Ripard,
	Chen-Yu Tsai, Thor Thayer, Florian Fainelli, Doug Berger,
	Sunil Goutham, Robert Richter, Fugang Duan, Madalin Bucur,
	Pantelis Antoniou, Claudiu Manoil, Li Yang, Yisen Zhuang,
	Salil Mehta, Hauke Mehrtens, Sebastian Hesselbarth,
	Thomas Petazzoni, Mirko Lindner, Stephen Hemminger,
	Felix Fietkau
  Cc: devel, Andrew Lunn, Greg Kroah-Hartman, linuxppc-dev,
	linux-mediatek, linux-kernel, linux-renesas-soc,
	bcm-kernel-feedback-list, nios2-dev, Petr Štetiar,
	linux-omap, Frank Rowand, linux-stm32, linux-arm-kernel,
	Heiner Kallweit

There was NVMEM support added to of_get_mac_address, so it could now
return ERR_PTR encoded error values, so we need to adjust all current
users of of_get_mac_address to this new fact.

While at it, remove superfluous is_valid_ether_addr as the MAC address
returned from of_get_mac_address is always valid and checked by
is_valid_ether_addr anyway.

Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---

 This is defacto v5 of the previous 05/10 patch in the series, but since the
 v4 of this 05/10 patch wasn't picked up by the patchwork for some unknown
 reason, this patch wasn't applied with the other 9 patches in the series, so
 I'm resending it as a separate patch of this fixup series.

 Changes since v1:

  * added Fixes: tag

 Previous changelog (Patch 05/10):

  Changes since v3:

   * IS_ERR_OR_NULL -> IS_ERR

  Changes since v4:

   * I've just blindly replaced IS_ERR_OR_NULL with IS_ERR, but I've just
     realized, that in some cases we still need to check for NULL, so I've
     corrected it in following drivers/files:

      - broadcom/bgmac-bcma.c
      - marvell/pxa168_eth.c
      - samsung/sxgbe/sxgbe_platform.c
      - stmicro/stmmac/stmmac_main.c
      - wiznet/w5100.c
      - ethernet/eth.c

 drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/ethoc.c                          | 2 +-
 drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
 drivers/net/ethernet/freescale/fec_main.c             | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
 drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
 drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
 drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
 drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 net/ethernet/eth.c                                    | 2 +-
 45 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 47e5984..7c5cf02 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device *ofdev)
 		const u8 *addr;
 
 		addr = of_get_mac_address(ofdev->dev.of_node);
-		if (addr) {
+		if (!IS_ERR(addr)) {
 			for (i = 0; i < 6; i++)
 				macaddr[i] = (unsigned int) addr[i];
 		} else {
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index e1acafa..37ebd89 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
 
 	/* Read MAC-address from DT */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	/* Check if the MAC address is valid, if not get a random one */
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index aa1d1f5..877e67f 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device *pdev)
 
 	/* get default MAC address from device tree */
 	macaddr = of_get_mac_address(pdev->dev.of_node);
-	if (macaddr)
+	if (!IS_ERR(macaddr))
 		ether_addr_copy(ndev->dev_addr, macaddr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index ff3d685..7f89ad5 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 	/* Get MAC address from device tree */
 	mac_addr = of_get_mac_address(dev->of_node);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index f62deeb..3c4967e 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device *pdev)
 	dev->irq = irq;
 
 	mac = of_get_mac_address(pdev->dev.of_node);
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(dev->dev_addr))
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4e87a30..c623896 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2505,7 +2505,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 
 	/* Initialize netdevice members */
 	macaddr = of_get_mac_address(dn);
-	if (!macaddr || !is_valid_ether_addr(macaddr)) {
+	if (IS_ERR(macaddr)) {
 		dev_warn(&pdev->dev, "using random Ethernet MAC\n");
 		eth_hw_addr_random(dev);
 	} else {
diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index 6fe074c..34d1830 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
 		mac = of_get_mac_address(bgmac->dev->of_node);
 
 	/* If no MAC address assigned via device tree, check SPROM */
-	if (!mac) {
+	if (IS_ERR_OR_NULL(mac)) {
 		switch (core->core_unit) {
 		case 0:
 			mac = sprom->et0mac;
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 894eda5..6dc0dd9 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
 	bgmac->dma_dev = &pdev->dev;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(bgmac->net_dev->dev_addr, mac_addr);
 	else
 		dev_warn(&pdev->dev, "MAC address not present in device tree\n");
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4fd9735..374b9ff 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 
 	if (dn) {
 		macaddr = of_get_mac_address(dn);
-		if (!macaddr) {
+		if (IS_ERR(macaddr)) {
 			dev_err(&pdev->dev, "can't find MAC address\n");
 			err = -EINVAL;
 			goto err;
diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 5359c10..15b1130 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1503,7 +1503,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 
 	mac = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		memcpy(netdev->dev_addr, mac, ETH_ALEN);
 	else
 		eth_hw_addr_random(netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 81c281a..a65be85 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1484,7 +1484,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
 			break;
 
 		mac = of_get_mac_address(node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(bgx->lmac[lmac].mac, mac);
 
 		SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev);
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index c2586f4..953ee56 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1412,7 +1412,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 		pdata->flags |= DM9000_PLATF_NO_EEPROM;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
 
 	return pdata;
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 0f3e7f2..71da049 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1153,7 +1153,7 @@ static int ethoc_probe(struct platform_device *pdev)
 		const void *mac;
 
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(netdev->dev_addr, mac);
 		priv->phy_id = -1;
 	}
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 659f1ad..b4ce261 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -616,7 +616,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
 
 	/* set kernel MAC address to dev */
 	mac_addr = of_get_mac_address(dev->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a96ad20..aa7d4e2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1655,7 +1655,7 @@ static void fec_get_mac(struct net_device *ndev)
 		struct device_node *np = fep->pdev->dev.of_node;
 		if (np) {
 			const char *mac = of_get_mac_address(np);
-			if (mac)
+			if (!IS_ERR(mac))
 				iap = (unsigned char *) mac;
 		}
 	}
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index c1968b3..7b7e526 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -902,7 +902,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
 	 * First try to read MAC address from DT
 	 */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	} else {
 		struct mpc52xx_fec __iomem *fec = priv->fec;
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 3c21486..9cd2c28 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -724,7 +724,7 @@ static int mac_probe(struct platform_device *_of_dev)
 
 	/* Get the MAC address */
 	mac_addr = of_get_mac_address(mac_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
 		err = -EINVAL;
 		goto _return_of_get_parent;
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 7c548ed..90ea7a1 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1014,7 +1014,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	spin_lock_init(&fep->tx_lock);
 
 	mac_addr = of_get_mac_address(ofdev->dev.of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	ret = fep->ops->allocate_bd(ndev);
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 45fcc96..df13c69 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -872,7 +872,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 
 	mac_addr = of_get_mac_address(np);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	if (model && !strcasecmp(model, "TSEC"))
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index eb3e65e..216e99a 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3910,7 +3910,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 	}
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	ugeth->ug_info = ug_info;
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index 2c28088..96c32ae 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -870,7 +870,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 			   phy_modes(phy->interface));
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index e5d853b..b1cb58f 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1229,7 +1229,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
 	}
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index d29104d..cda641e 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -478,7 +478,7 @@ static int xrx200_probe(struct platform_device *pdev)
 	}
 
 	mac = of_get_mac_address(np);
-	if (mac && is_valid_ether_addr(mac))
+	if (!IS_ERR(mac))
 		ether_addr_copy(net_dev->dev_addr, mac);
 	else
 		eth_hw_addr_random(net_dev);
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 292a668..07e254f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2749,7 +2749,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 	}
 
 	mac_addr = of_get_mac_address(pnp);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
 
 	mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index a715277..8186135 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4563,7 +4563,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	}
 
 	dt_mac_addr = of_get_mac_address(dn);
-	if (dt_mac_addr) {
+	if (!IS_ERR(dt_mac_addr)) {
 		mac_from = "device tree";
 		memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
 	} else {
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 35f2142..ce037e8 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1461,7 +1461,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node)
 		mac_addr = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac_addr && is_valid_ether_addr(mac_addr)) {
+	if (!IS_ERR_OR_NULL(mac_addr)) {
 		ether_addr_copy(dev->dev_addr, mac_addr);
 	} else {
 		/* try reading the mac address, if set by the bootloader */
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 8b3495e..c4050ec 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4808,7 +4808,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
 	 * 2) from internal registers set by bootloader
 	 */
 	iap = of_get_mac_address(hw->pdev->dev.of_node);
-	if (iap)
+	if (!IS_ERR(iap))
 		memcpy(dev->dev_addr, iap, ETH_ALEN);
 	else
 		memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 53abe92..f9fbb3f 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2028,7 +2028,7 @@ static int __init mtk_init(struct net_device *dev)
 	const char *mac_addr;
 
 	mac_addr = of_get_mac_address(mac->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(dev->dev_addr, mac_addr);
 
 	/* If the mac address is invalid, use random mac address  */
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 7849119..b44172a 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -425,7 +425,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
 	const u8 *mac_addr;
 
 	mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 		ks8851_write_mac_addr(dev);
 		return;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index c946841..dc76b0d 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1327,7 +1327,7 @@ static int ks8851_probe(struct platform_device *pdev)
 	/* overwriting the default MAC address */
 	if (pdev->dev.of_node) {
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			memcpy(ks->mac_addr, mac, ETH_ALEN);
 	} else {
 		struct ks8851_mll_platform_data *pdata;
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 89d1739..da138ed 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1368,7 +1368,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-		if (macaddr)
+		if (!IS_ERR(macaddr))
 			memcpy(ndev->dev_addr, macaddr, ETH_ALEN);
 	}
 	if (!is_valid_ether_addr(ndev->dev_addr))
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 97f9295..b28360b 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -966,7 +966,7 @@
 
 	mac = of_get_mac_address(spi->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c
index db6068c..5906168 100644
--- a/drivers/net/ethernet/qualcomm/qca_uart.c
+++ b/drivers/net/ethernet/qualcomm/qca_uart.c
@@ -351,7 +351,7 @@ static int qca_uart_probe(struct serdev_device *serdev)
 
 	mac = of_get_mac_address(serdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9618c48..d3ffcf5 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -111,7 +111,7 @@ static void ravb_set_buffer_align(struct sk_buff *skb)
  */
 static void ravb_read_mac_address(struct net_device *ndev, const u8 *mac)
 {
-	if (mac) {
+	if (!IS_ERR(mac)) {
 		ether_addr_copy(ndev->dev_addr, mac);
 	} else {
 		u32 mahr = ravb_read(ndev, MAHR);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e33af37..4d4be66 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
 	pdata->phy_interface = ret;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
 
 	pdata->no_ether_link =
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index fbd00cb..d2bc941 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -124,7 +124,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 	}
 
 	/* Get MAC address if available (DT) */
-	if (mac)
+	if (!IS_ERR_OR_NULL(mac))
 		ether_addr_copy(priv->dev->dev_addr, mac);
 
 	/* Get the TX/RX IRQ numbers */
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index bb6d5fb..51a7b48 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
 	ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 
 	/* if the mac address is invalid, use random mac address */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5ab2733..5678b86 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4262,7 +4262,7 @@ int stmmac_dvr_probe(struct device *device,
 	priv->wol_irq = res->wol_irq;
 	priv->lpi_irq = res->lpi_irq;
 
-	if (res->mac)
+	if (!IS_ERR_OR_NULL(res->mac))
 		memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
 
 	dev_set_drvdata(device, priv->dev);
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e376806..b18eeb0 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2232,7 +2232,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 
 no_phy_slave:
 		mac_addr = of_get_mac_address(slave_node);
-		if (mac_addr) {
+		if (!IS_ERR(mac_addr)) {
 			memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
 		} else {
 			ret = ti_cm_get_macid(&pdev->dev, i,
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 01d4ca3..6428439 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2037,7 +2037,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
 		devm_release_mem_region(dev, res.start, size);
 	} else {
 		mac_addr = of_get_mac_address(node_interface);
-		if (mac_addr)
+		if (!IS_ERR(mac_addr))
 			ether_addr_copy(ndev->dev_addr, mac_addr);
 		else
 			eth_random_addr(ndev->dev_addr);
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index d8ba512..b0052933 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -1164,7 +1164,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops,
 	INIT_WORK(&priv->setrx_work, w5100_setrx_work);
 	INIT_WORK(&priv->restart_work, w5100_restart_work);
 
-	if (mac_addr)
+	if (!IS_ERR_OR_NULL(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9851991..f389a81 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1252,7 +1252,7 @@ static int temac_probe(struct platform_device *pdev)
 	if (temac_np) {
 		/* Retrieve the MAC address */
 		addr = of_get_mac_address(temac_np);
-		if (!addr) {
+		if (IS_ERR(addr)) {
 			dev_err(&pdev->dev, "could not find MAC address\n");
 			return -ENODEV;
 		}
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4041c75..108fbc7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1596,7 +1596,7 @@ static int axienet_probe(struct platform_device *pdev)
 
 	/* Retrieve the MAC address */
 	mac_addr = of_get_mac_address(pdev->dev.of_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(&pdev->dev, "could not find MAC address\n");
 		goto free_netdev;
 	}
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index fc38692..6911707 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1165,7 +1165,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 	mac_address = of_get_mac_address(ofdev->dev.of_node);
 
-	if (mac_address) {
+	if (!IS_ERR(mac_address)) {
 		/* Set the MAC address. */
 		memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
 	} else {
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index fddcee3..4b2b222 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -560,7 +560,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
 	addr = NULL;
 	if (dp)
 		addr = of_get_mac_address(dp);
-	if (!addr)
+	if (IS_ERR_OR_NULL(addr))
 		addr = arch_get_platform_mac_address();
 
 	if (!addr)
-- 
1.9.1

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error
@ 2019-05-06 21:24   ` Petr Štetiar
  0 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Andreas Larsson, Maxime Ripard,
	Chen-Yu Tsai, Thor Thayer, Florian Fainelli, Doug Berger,
	Sunil Goutham, Robert Richter, Fugang Duan, Madalin Bucur,
	Pantelis Antoniou, Claudiu Manoil, Li Yang, Yisen Zhuang,
	Salil Mehta, Hauke Mehrtens, Sebastian Hesselbarth,
	Thomas Petazzoni, Mirko Lindner, Stephen Hemminger,
	Felix Fietkau, John Crispin, Sean Wang, Nelson Chang,
	Matthias Brugger, Vladimir Zapolskiy, Sylvain Lemieux,
	Sergei Shtylyov, Byungho An, Girish K S, Vipul Pandya,
	Kunihiko Hayashi, Giuseppe Cavallaro, Alexandre Torgue,
	Jose Abreu, Maxime Coquelin, Grygorii Strashko, Wingman Kwok,
	Murali Karicheri, Michal Simek, Anirudha Sarangi, John Linn
  Cc: devel, Andrew Lunn, Greg Kroah-Hartman, linuxppc-dev,
	linux-mediatek, linux-kernel, linux-renesas-soc,
	bcm-kernel-feedback-list, nios2-dev, Petr Štetiar,
	linux-omap, Frank Rowand, linux-stm32, linux-arm-kernel,
	Heiner Kallweit

There was NVMEM support added to of_get_mac_address, so it could now
return ERR_PTR encoded error values, so we need to adjust all current
users of of_get_mac_address to this new fact.

While at it, remove superfluous is_valid_ether_addr as the MAC address
returned from of_get_mac_address is always valid and checked by
is_valid_ether_addr anyway.

Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---

 This is defacto v5 of the previous 05/10 patch in the series, but since the
 v4 of this 05/10 patch wasn't picked up by the patchwork for some unknown
 reason, this patch wasn't applied with the other 9 patches in the series, so
 I'm resending it as a separate patch of this fixup series.

 Changes since v1:

  * added Fixes: tag

 Previous changelog (Patch 05/10):

  Changes since v3:

   * IS_ERR_OR_NULL -> IS_ERR

  Changes since v4:

   * I've just blindly replaced IS_ERR_OR_NULL with IS_ERR, but I've just
     realized, that in some cases we still need to check for NULL, so I've
     corrected it in following drivers/files:

      - broadcom/bgmac-bcma.c
      - marvell/pxa168_eth.c
      - samsung/sxgbe/sxgbe_platform.c
      - stmicro/stmmac/stmmac_main.c
      - wiznet/w5100.c
      - ethernet/eth.c

 drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/ethoc.c                          | 2 +-
 drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
 drivers/net/ethernet/freescale/fec_main.c             | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
 drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
 drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
 drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
 drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 net/ethernet/eth.c                                    | 2 +-
 45 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 47e5984..7c5cf02 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device *ofdev)
 		const u8 *addr;
 
 		addr = of_get_mac_address(ofdev->dev.of_node);
-		if (addr) {
+		if (!IS_ERR(addr)) {
 			for (i = 0; i < 6; i++)
 				macaddr[i] = (unsigned int) addr[i];
 		} else {
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index e1acafa..37ebd89 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
 
 	/* Read MAC-address from DT */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	/* Check if the MAC address is valid, if not get a random one */
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index aa1d1f5..877e67f 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device *pdev)
 
 	/* get default MAC address from device tree */
 	macaddr = of_get_mac_address(pdev->dev.of_node);
-	if (macaddr)
+	if (!IS_ERR(macaddr))
 		ether_addr_copy(ndev->dev_addr, macaddr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index ff3d685..7f89ad5 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 	/* Get MAC address from device tree */
 	mac_addr = of_get_mac_address(dev->of_node);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index f62deeb..3c4967e 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device *pdev)
 	dev->irq = irq;
 
 	mac = of_get_mac_address(pdev->dev.of_node);
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(dev->dev_addr))
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4e87a30..c623896 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2505,7 +2505,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 
 	/* Initialize netdevice members */
 	macaddr = of_get_mac_address(dn);
-	if (!macaddr || !is_valid_ether_addr(macaddr)) {
+	if (IS_ERR(macaddr)) {
 		dev_warn(&pdev->dev, "using random Ethernet MAC\n");
 		eth_hw_addr_random(dev);
 	} else {
diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index 6fe074c..34d1830 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
 		mac = of_get_mac_address(bgmac->dev->of_node);
 
 	/* If no MAC address assigned via device tree, check SPROM */
-	if (!mac) {
+	if (IS_ERR_OR_NULL(mac)) {
 		switch (core->core_unit) {
 		case 0:
 			mac = sprom->et0mac;
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 894eda5..6dc0dd9 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
 	bgmac->dma_dev = &pdev->dev;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(bgmac->net_dev->dev_addr, mac_addr);
 	else
 		dev_warn(&pdev->dev, "MAC address not present in device tree\n");
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4fd9735..374b9ff 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 
 	if (dn) {
 		macaddr = of_get_mac_address(dn);
-		if (!macaddr) {
+		if (IS_ERR(macaddr)) {
 			dev_err(&pdev->dev, "can't find MAC address\n");
 			err = -EINVAL;
 			goto err;
diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 5359c10..15b1130 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1503,7 +1503,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 
 	mac = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		memcpy(netdev->dev_addr, mac, ETH_ALEN);
 	else
 		eth_hw_addr_random(netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 81c281a..a65be85 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1484,7 +1484,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
 			break;
 
 		mac = of_get_mac_address(node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(bgx->lmac[lmac].mac, mac);
 
 		SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev);
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index c2586f4..953ee56 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1412,7 +1412,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 		pdata->flags |= DM9000_PLATF_NO_EEPROM;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
 
 	return pdata;
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 0f3e7f2..71da049 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1153,7 +1153,7 @@ static int ethoc_probe(struct platform_device *pdev)
 		const void *mac;
 
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(netdev->dev_addr, mac);
 		priv->phy_id = -1;
 	}
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 659f1ad..b4ce261 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -616,7 +616,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
 
 	/* set kernel MAC address to dev */
 	mac_addr = of_get_mac_address(dev->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a96ad20..aa7d4e2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1655,7 +1655,7 @@ static void fec_get_mac(struct net_device *ndev)
 		struct device_node *np = fep->pdev->dev.of_node;
 		if (np) {
 			const char *mac = of_get_mac_address(np);
-			if (mac)
+			if (!IS_ERR(mac))
 				iap = (unsigned char *) mac;
 		}
 	}
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index c1968b3..7b7e526 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -902,7 +902,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
 	 * First try to read MAC address from DT
 	 */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	} else {
 		struct mpc52xx_fec __iomem *fec = priv->fec;
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 3c21486..9cd2c28 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -724,7 +724,7 @@ static int mac_probe(struct platform_device *_of_dev)
 
 	/* Get the MAC address */
 	mac_addr = of_get_mac_address(mac_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
 		err = -EINVAL;
 		goto _return_of_get_parent;
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 7c548ed..90ea7a1 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1014,7 +1014,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	spin_lock_init(&fep->tx_lock);
 
 	mac_addr = of_get_mac_address(ofdev->dev.of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	ret = fep->ops->allocate_bd(ndev);
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 45fcc96..df13c69 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -872,7 +872,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 
 	mac_addr = of_get_mac_address(np);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	if (model && !strcasecmp(model, "TSEC"))
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index eb3e65e..216e99a 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3910,7 +3910,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 	}
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	ugeth->ug_info = ug_info;
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index 2c28088..96c32ae 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -870,7 +870,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 			   phy_modes(phy->interface));
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index e5d853b..b1cb58f 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1229,7 +1229,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
 	}
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index d29104d..cda641e 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -478,7 +478,7 @@ static int xrx200_probe(struct platform_device *pdev)
 	}
 
 	mac = of_get_mac_address(np);
-	if (mac && is_valid_ether_addr(mac))
+	if (!IS_ERR(mac))
 		ether_addr_copy(net_dev->dev_addr, mac);
 	else
 		eth_hw_addr_random(net_dev);
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 292a668..07e254f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2749,7 +2749,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 	}
 
 	mac_addr = of_get_mac_address(pnp);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
 
 	mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index a715277..8186135 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4563,7 +4563,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	}
 
 	dt_mac_addr = of_get_mac_address(dn);
-	if (dt_mac_addr) {
+	if (!IS_ERR(dt_mac_addr)) {
 		mac_from = "device tree";
 		memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
 	} else {
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 35f2142..ce037e8 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1461,7 +1461,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node)
 		mac_addr = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac_addr && is_valid_ether_addr(mac_addr)) {
+	if (!IS_ERR_OR_NULL(mac_addr)) {
 		ether_addr_copy(dev->dev_addr, mac_addr);
 	} else {
 		/* try reading the mac address, if set by the bootloader */
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 8b3495e..c4050ec 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4808,7 +4808,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
 	 * 2) from internal registers set by bootloader
 	 */
 	iap = of_get_mac_address(hw->pdev->dev.of_node);
-	if (iap)
+	if (!IS_ERR(iap))
 		memcpy(dev->dev_addr, iap, ETH_ALEN);
 	else
 		memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 53abe92..f9fbb3f 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2028,7 +2028,7 @@ static int __init mtk_init(struct net_device *dev)
 	const char *mac_addr;
 
 	mac_addr = of_get_mac_address(mac->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(dev->dev_addr, mac_addr);
 
 	/* If the mac address is invalid, use random mac address  */
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 7849119..b44172a 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -425,7 +425,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
 	const u8 *mac_addr;
 
 	mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 		ks8851_write_mac_addr(dev);
 		return;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index c946841..dc76b0d 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1327,7 +1327,7 @@ static int ks8851_probe(struct platform_device *pdev)
 	/* overwriting the default MAC address */
 	if (pdev->dev.of_node) {
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			memcpy(ks->mac_addr, mac, ETH_ALEN);
 	} else {
 		struct ks8851_mll_platform_data *pdata;
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 89d1739..da138ed 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1368,7 +1368,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-		if (macaddr)
+		if (!IS_ERR(macaddr))
 			memcpy(ndev->dev_addr, macaddr, ETH_ALEN);
 	}
 	if (!is_valid_ether_addr(ndev->dev_addr))
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 97f9295..b28360b 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -966,7 +966,7 @@
 
 	mac = of_get_mac_address(spi->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c
index db6068c..5906168 100644
--- a/drivers/net/ethernet/qualcomm/qca_uart.c
+++ b/drivers/net/ethernet/qualcomm/qca_uart.c
@@ -351,7 +351,7 @@ static int qca_uart_probe(struct serdev_device *serdev)
 
 	mac = of_get_mac_address(serdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9618c48..d3ffcf5 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -111,7 +111,7 @@ static void ravb_set_buffer_align(struct sk_buff *skb)
  */
 static void ravb_read_mac_address(struct net_device *ndev, const u8 *mac)
 {
-	if (mac) {
+	if (!IS_ERR(mac)) {
 		ether_addr_copy(ndev->dev_addr, mac);
 	} else {
 		u32 mahr = ravb_read(ndev, MAHR);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e33af37..4d4be66 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
 	pdata->phy_interface = ret;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
 
 	pdata->no_ether_link =
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index fbd00cb..d2bc941 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -124,7 +124,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 	}
 
 	/* Get MAC address if available (DT) */
-	if (mac)
+	if (!IS_ERR_OR_NULL(mac))
 		ether_addr_copy(priv->dev->dev_addr, mac);
 
 	/* Get the TX/RX IRQ numbers */
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index bb6d5fb..51a7b48 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
 	ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 
 	/* if the mac address is invalid, use random mac address */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5ab2733..5678b86 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4262,7 +4262,7 @@ int stmmac_dvr_probe(struct device *device,
 	priv->wol_irq = res->wol_irq;
 	priv->lpi_irq = res->lpi_irq;
 
-	if (res->mac)
+	if (!IS_ERR_OR_NULL(res->mac))
 		memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
 
 	dev_set_drvdata(device, priv->dev);
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e376806..b18eeb0 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2232,7 +2232,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 
 no_phy_slave:
 		mac_addr = of_get_mac_address(slave_node);
-		if (mac_addr) {
+		if (!IS_ERR(mac_addr)) {
 			memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
 		} else {
 			ret = ti_cm_get_macid(&pdev->dev, i,
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 01d4ca3..6428439 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2037,7 +2037,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
 		devm_release_mem_region(dev, res.start, size);
 	} else {
 		mac_addr = of_get_mac_address(node_interface);
-		if (mac_addr)
+		if (!IS_ERR(mac_addr))
 			ether_addr_copy(ndev->dev_addr, mac_addr);
 		else
 			eth_random_addr(ndev->dev_addr);
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index d8ba512..b0052933 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -1164,7 +1164,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops,
 	INIT_WORK(&priv->setrx_work, w5100_setrx_work);
 	INIT_WORK(&priv->restart_work, w5100_restart_work);
 
-	if (mac_addr)
+	if (!IS_ERR_OR_NULL(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9851991..f389a81 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1252,7 +1252,7 @@ static int temac_probe(struct platform_device *pdev)
 	if (temac_np) {
 		/* Retrieve the MAC address */
 		addr = of_get_mac_address(temac_np);
-		if (!addr) {
+		if (IS_ERR(addr)) {
 			dev_err(&pdev->dev, "could not find MAC address\n");
 			return -ENODEV;
 		}
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4041c75..108fbc7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1596,7 +1596,7 @@ static int axienet_probe(struct platform_device *pdev)
 
 	/* Retrieve the MAC address */
 	mac_addr = of_get_mac_address(pdev->dev.of_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(&pdev->dev, "could not find MAC address\n");
 		goto free_netdev;
 	}
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index fc38692..6911707 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1165,7 +1165,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 	mac_address = of_get_mac_address(ofdev->dev.of_node);
 
-	if (mac_address) {
+	if (!IS_ERR(mac_address)) {
 		/* Set the MAC address. */
 		memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
 	} else {
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index fddcee3..4b2b222 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -560,7 +560,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
 	addr = NULL;
 	if (dp)
 		addr = of_get_mac_address(dp);
-	if (!addr)
+	if (IS_ERR_OR_NULL(addr))
 		addr = arch_get_platform_mac_address();
 
 	if (!addr)
-- 
1.9.1


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

* [PATCH net-next v2 2/4] net: dsa: support of_get_mac_address new ERR_PTR error
  2019-05-06 21:24 ` Petr Štetiar
  (?)
  (?)
@ 2019-05-06 21:24 ` Petr Štetiar
  2019-05-07 13:49   ` Vladimir Oltean
  -1 siblings, 1 reply; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Andrew Lunn, Vivien Didelot, Florian Fainelli
  Cc: Heiner Kallweit, Frank Rowand, devel, linux-kernel,
	Greg Kroah-Hartman, Maxime Ripard, Petr Štetiar

There was NVMEM support added to of_get_mac_address, so it could now
return ERR_PTR encoded error values, so we need to adjust all current
users of of_get_mac_address to this new fact.

While at it, remove superfluous is_valid_ether_addr as the MAC address
returned from of_get_mac_address is always valid and checked by
is_valid_ether_addr anyway.

Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 net/dsa/slave.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 316bce9..fe7b6a6 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -1418,7 +1418,7 @@ int dsa_slave_create(struct dsa_port *port)
 				NETIF_F_HW_VLAN_CTAG_FILTER;
 	slave_dev->hw_features |= NETIF_F_HW_TC;
 	slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
-	if (port->mac && is_valid_ether_addr(port->mac))
+	if (!IS_ERR_OR_NULL(port->mac))
 		ether_addr_copy(slave_dev->dev_addr, port->mac);
 	else
 		eth_hw_addr_inherit(slave_dev, master);
-- 
1.9.1


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

* [PATCH net-next v2 3/4] staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
  2019-05-06 21:24 ` Petr Štetiar
                   ` (2 preceding siblings ...)
  (?)
@ 2019-05-06 21:24 ` Petr Štetiar
  -1 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Greg Kroah-Hartman
  Cc: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Frank Rowand,
	devel, linux-kernel, Maxime Ripard, Petr Štetiar

Commit 284eb160681c ("staging: octeon-ethernet: support
of_get_mac_address new ERR_PTR error") has introduced checking for
ERR_PTR encoded error value from of_get_mac_address with IS_ERR macro,
which is not sufficient in this case, as the mac variable is set to NULL
initialy and if the kernel is compiled without DT support this NULL
would get passed to IS_ERR, which would lead to the wrong decision and
would pass that NULL pointer and invalid MAC address further.

Fixes: 284eb160681c ("staging: octeon-ethernet: support of_get_mac_address new ERR_PTR error")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/staging/octeon/ethernet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/staging/octeon/ethernet.c b/drivers/staging/octeon/ethernet.c
index 2b03018..8847a11c2 100644
--- a/drivers/staging/octeon/ethernet.c
+++ b/drivers/staging/octeon/ethernet.c
@@ -421,7 +421,7 @@ int cvm_oct_common_init(struct net_device *dev)
 	if (priv->of_node)
 		mac = of_get_mac_address(priv->of_node);
 
-	if (!IS_ERR(mac))
+	if (!IS_ERR_OR_NULL(mac))
 		ether_addr_copy(dev->dev_addr, mac);
 	else
 		eth_hw_addr_random(dev);
-- 
1.9.1


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

* [PATCH net-next v2 4/4] net: usb: smsc: fix warning reported by kbuild test robot
  2019-05-06 21:24 ` Petr Štetiar
                   ` (3 preceding siblings ...)
  (?)
@ 2019-05-06 21:24 ` Petr Štetiar
  2019-05-06 21:29   ` Woojung.Huh
  -1 siblings, 1 reply; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:24 UTC (permalink / raw)
  To: netdev, David S. Miller, Steve Glendinning,
	Microchip Linux Driver Support
  Cc: Andrew Lunn, Florian Fainelli, Heiner Kallweit, Frank Rowand,
	devel, linux-kernel, Greg Kroah-Hartman, Maxime Ripard,
	Petr Štetiar, linux-usb

This patch fixes following warning reported by kbuild test robot:

 In function ‘memcpy’,
     inlined from ‘smsc75xx_init_mac_address’ at drivers/net/usb/smsc75xx.c:778:3,
     inlined from ‘smsc75xx_bind’ at drivers/net/usb/smsc75xx.c:1501:2:
 ./include/linux/string.h:355:9: warning: argument 2 null where non-null expected [-Wnonnull]
   return __builtin_memcpy(p, q, size);
          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
 drivers/net/usb/smsc75xx.c: In function ‘smsc75xx_bind’:
 ./include/linux/string.h:355:9: note: in a call to built-in function ‘__builtin_memcpy’

I've replaced the offending memcpy with ether_addr_copy, because I'm
100% sure, that of_get_mac_address can't return NULL as it returns valid
pointer or ERR_PTR encoded value, nothing else.

I'm hesitant to just change IS_ERR into IS_ERR_OR_NULL check, as this
would make the warning disappear also, but it would be confusing to
check for impossible return value just to make a compiler happy.

Fixes: adfb3cb2c52e ("net: usb: support of_get_mac_address new ERR_PTR error")
Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---
 drivers/net/usb/smsc75xx.c | 2 +-
 drivers/net/usb/smsc95xx.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/usb/smsc75xx.c b/drivers/net/usb/smsc75xx.c
index d27b627..e4c2f3a 100644
--- a/drivers/net/usb/smsc75xx.c
+++ b/drivers/net/usb/smsc75xx.c
@@ -775,7 +775,7 @@ static void smsc75xx_init_mac_address(struct usbnet *dev)
 	/* maybe the boot loader passed the MAC address in devicetree */
 	mac_addr = of_get_mac_address(dev->udev->dev.of_node);
 	if (!IS_ERR(mac_addr)) {
-		memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->net->dev_addr, mac_addr);
 		return;
 	}
 
diff --git a/drivers/net/usb/smsc95xx.c b/drivers/net/usb/smsc95xx.c
index ab23911..a0e1199 100644
--- a/drivers/net/usb/smsc95xx.c
+++ b/drivers/net/usb/smsc95xx.c
@@ -918,7 +918,7 @@ static void smsc95xx_init_mac_address(struct usbnet *dev)
 	/* maybe the boot loader passed the MAC address in devicetree */
 	mac_addr = of_get_mac_address(dev->udev->dev.of_node);
 	if (!IS_ERR(mac_addr)) {
-		memcpy(dev->net->dev_addr, mac_addr, ETH_ALEN);
+		ether_addr_copy(dev->net->dev_addr, mac_addr);
 		return;
 	}
 
-- 
1.9.1


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

* [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error
  2019-05-06 21:24 ` Petr Štetiar
                   ` (4 preceding siblings ...)
  (?)
@ 2019-05-06 21:27 ` Petr Štetiar
  -1 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-06 21:27 UTC (permalink / raw)
  To: netdev; +Cc: Petr Štetiar

There was NVMEM support added to of_get_mac_address, so it could now
return ERR_PTR encoded error values, so we need to adjust all current
users of of_get_mac_address to this new fact.

While at it, remove superfluous is_valid_ether_addr as the MAC address
returned from of_get_mac_address is always valid and checked by
is_valid_ether_addr anyway.

Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
Signed-off-by: Petr Štetiar <ynezz@true.cz>
---

 This is defacto v5 of the previous 05/10 patch in the series, but since the
 v4 of this 05/10 patch wasn't picked up by the patchwork for some unknown
 reason, this patch wasn't applied with the other 9 patches in the series, so
 I'm resending it as a separate patch of this fixup series.

 Changes since v1:

  * added Fixes: tag

 Previous changelog (Patch 05/10):

  Changes since v3:

   * IS_ERR_OR_NULL -> IS_ERR

  Changes since v4:

   * I've just blindly replaced IS_ERR_OR_NULL with IS_ERR, but I've just
     realized, that in some cases we still need to check for NULL, so I've
     corrected it in following drivers/files:

      - broadcom/bgmac-bcma.c
      - marvell/pxa168_eth.c
      - samsung/sxgbe/sxgbe_platform.c
      - stmicro/stmmac/stmmac_main.c
      - wiznet/w5100.c
      - ethernet/eth.c

 drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
 drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
 drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
 drivers/net/ethernet/arc/emac_main.c                  | 2 +-
 drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
 drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
 drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
 drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
 drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
 drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
 drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
 drivers/net/ethernet/ethoc.c                          | 2 +-
 drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
 drivers/net/ethernet/freescale/fec_main.c             | 2 +-
 drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
 drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
 drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
 drivers/net/ethernet/freescale/gianfar.c              | 2 +-
 drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
 drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
 drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
 drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
 drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
 drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
 drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
 drivers/net/ethernet/marvell/sky2.c                   | 2 +-
 drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
 drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
 drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
 drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
 drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
 drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
 drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
 drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
 drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
 drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
 drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
 drivers/net/ethernet/ti/cpsw.c                        | 2 +-
 drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
 drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
 drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
 drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
 drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
 net/ethernet/eth.c                                    | 2 +-
 45 files changed, 45 insertions(+), 45 deletions(-)

diff --git a/drivers/net/ethernet/aeroflex/greth.c b/drivers/net/ethernet/aeroflex/greth.c
index 47e5984..7c5cf02 100644
--- a/drivers/net/ethernet/aeroflex/greth.c
+++ b/drivers/net/ethernet/aeroflex/greth.c
@@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device *ofdev)
 		const u8 *addr;
 
 		addr = of_get_mac_address(ofdev->dev.of_node);
-		if (addr) {
+		if (!IS_ERR(addr)) {
 			for (i = 0; i < 6; i++)
 				macaddr[i] = (unsigned int) addr[i];
 		} else {
diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c b/drivers/net/ethernet/allwinner/sun4i-emac.c
index e1acafa..37ebd89 100644
--- a/drivers/net/ethernet/allwinner/sun4i-emac.c
+++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
@@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
 
 	/* Read MAC-address from DT */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	/* Check if the MAC address is valid, if not get a random one */
diff --git a/drivers/net/ethernet/altera/altera_tse_main.c b/drivers/net/ethernet/altera/altera_tse_main.c
index aa1d1f5..877e67f 100644
--- a/drivers/net/ethernet/altera/altera_tse_main.c
+++ b/drivers/net/ethernet/altera/altera_tse_main.c
@@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device *pdev)
 
 	/* get default MAC address from device tree */
 	macaddr = of_get_mac_address(pdev->dev.of_node);
-	if (macaddr)
+	if (!IS_ERR(macaddr))
 		ether_addr_copy(ndev->dev_addr, macaddr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/arc/emac_main.c b/drivers/net/ethernet/arc/emac_main.c
index ff3d685..7f89ad5 100644
--- a/drivers/net/ethernet/arc/emac_main.c
+++ b/drivers/net/ethernet/arc/emac_main.c
@@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int interface)
 	/* Get MAC address from device tree */
 	mac_addr = of_get_mac_address(dev->of_node);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/aurora/nb8800.c b/drivers/net/ethernet/aurora/nb8800.c
index f62deeb..3c4967e 100644
--- a/drivers/net/ethernet/aurora/nb8800.c
+++ b/drivers/net/ethernet/aurora/nb8800.c
@@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device *pdev)
 	dev->irq = irq;
 
 	mac = of_get_mac_address(pdev->dev.of_node);
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(dev->dev_addr))
diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c b/drivers/net/ethernet/broadcom/bcmsysport.c
index 4e87a30..c623896 100644
--- a/drivers/net/ethernet/broadcom/bcmsysport.c
+++ b/drivers/net/ethernet/broadcom/bcmsysport.c
@@ -2505,7 +2505,7 @@ static int bcm_sysport_probe(struct platform_device *pdev)
 
 	/* Initialize netdevice members */
 	macaddr = of_get_mac_address(dn);
-	if (!macaddr || !is_valid_ether_addr(macaddr)) {
+	if (IS_ERR(macaddr)) {
 		dev_warn(&pdev->dev, "using random Ethernet MAC\n");
 		eth_hw_addr_random(dev);
 	} else {
diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c b/drivers/net/ethernet/broadcom/bgmac-bcma.c
index 6fe074c..34d1830 100644
--- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
+++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
@@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
 		mac = of_get_mac_address(bgmac->dev->of_node);
 
 	/* If no MAC address assigned via device tree, check SPROM */
-	if (!mac) {
+	if (IS_ERR_OR_NULL(mac)) {
 		switch (core->core_unit) {
 		case 0:
 			mac = sprom->et0mac;
diff --git a/drivers/net/ethernet/broadcom/bgmac-platform.c b/drivers/net/ethernet/broadcom/bgmac-platform.c
index 894eda5..6dc0dd9 100644
--- a/drivers/net/ethernet/broadcom/bgmac-platform.c
+++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
@@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
 	bgmac->dma_dev = &pdev->dev;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(bgmac->net_dev->dev_addr, mac_addr);
 	else
 		dev_warn(&pdev->dev, "MAC address not present in device tree\n");
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 4fd9735..374b9ff 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device *pdev)
 
 	if (dn) {
 		macaddr = of_get_mac_address(dn);
-		if (!macaddr) {
+		if (IS_ERR(macaddr)) {
 			dev_err(&pdev->dev, "can't find MAC address\n");
 			err = -EINVAL;
 			goto err;
diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index 5359c10..15b1130 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1503,7 +1503,7 @@ static int octeon_mgmt_probe(struct platform_device *pdev)
 
 	mac = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		memcpy(netdev->dev_addr, mac, ETH_ALEN);
 	else
 		eth_hw_addr_random(netdev);
diff --git a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
index 81c281a..a65be85 100644
--- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
+++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
@@ -1484,7 +1484,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
 			break;
 
 		mac = of_get_mac_address(node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(bgx->lmac[lmac].mac, mac);
 
 		SET_NETDEV_DEV(&bgx->lmac[lmac].netdev, &bgx->pdev->dev);
diff --git a/drivers/net/ethernet/davicom/dm9000.c b/drivers/net/ethernet/davicom/dm9000.c
index c2586f4..953ee56 100644
--- a/drivers/net/ethernet/davicom/dm9000.c
+++ b/drivers/net/ethernet/davicom/dm9000.c
@@ -1412,7 +1412,7 @@ static struct dm9000_plat_data *dm9000_parse_dt(struct device *dev)
 		pdata->flags |= DM9000_PLATF_NO_EEPROM;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->dev_addr, mac_addr, sizeof(pdata->dev_addr));
 
 	return pdata;
diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
index 0f3e7f2..71da049 100644
--- a/drivers/net/ethernet/ethoc.c
+++ b/drivers/net/ethernet/ethoc.c
@@ -1153,7 +1153,7 @@ static int ethoc_probe(struct platform_device *pdev)
 		const void *mac;
 
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			ether_addr_copy(netdev->dev_addr, mac);
 		priv->phy_id = -1;
 	}
diff --git a/drivers/net/ethernet/ezchip/nps_enet.c b/drivers/net/ethernet/ezchip/nps_enet.c
index 659f1ad..b4ce261 100644
--- a/drivers/net/ethernet/ezchip/nps_enet.c
+++ b/drivers/net/ethernet/ezchip/nps_enet.c
@@ -616,7 +616,7 @@ static s32 nps_enet_probe(struct platform_device *pdev)
 
 	/* set kernel MAC address to dev */
 	mac_addr = of_get_mac_address(dev->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index a96ad20..aa7d4e2 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -1655,7 +1655,7 @@ static void fec_get_mac(struct net_device *ndev)
 		struct device_node *np = fep->pdev->dev.of_node;
 		if (np) {
 			const char *mac = of_get_mac_address(np);
-			if (mac)
+			if (!IS_ERR(mac))
 				iap = (unsigned char *) mac;
 		}
 	}
diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c b/drivers/net/ethernet/freescale/fec_mpc52xx.c
index c1968b3..7b7e526 100644
--- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
+++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
@@ -902,7 +902,7 @@ static int mpc52xx_fec_probe(struct platform_device *op)
 	 * First try to read MAC address from DT
 	 */
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	} else {
 		struct mpc52xx_fec __iomem *fec = priv->fec;
diff --git a/drivers/net/ethernet/freescale/fman/mac.c b/drivers/net/ethernet/freescale/fman/mac.c
index 3c21486..9cd2c28 100644
--- a/drivers/net/ethernet/freescale/fman/mac.c
+++ b/drivers/net/ethernet/freescale/fman/mac.c
@@ -724,7 +724,7 @@ static int mac_probe(struct platform_device *_of_dev)
 
 	/* Get the MAC address */
 	mac_addr = of_get_mac_address(mac_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(dev, "of_get_mac_address(%pOF) failed\n", mac_node);
 		err = -EINVAL;
 		goto _return_of_get_parent;
diff --git a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
index 7c548ed..90ea7a1 100644
--- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
+++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
@@ -1014,7 +1014,7 @@ static int fs_enet_probe(struct platform_device *ofdev)
 	spin_lock_init(&fep->tx_lock);
 
 	mac_addr = of_get_mac_address(ofdev->dev.of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 
 	ret = fep->ops->allocate_bd(ndev);
diff --git a/drivers/net/ethernet/freescale/gianfar.c b/drivers/net/ethernet/freescale/gianfar.c
index 45fcc96..df13c69 100644
--- a/drivers/net/ethernet/freescale/gianfar.c
+++ b/drivers/net/ethernet/freescale/gianfar.c
@@ -872,7 +872,7 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
 
 	mac_addr = of_get_mac_address(np);
 
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	if (model && !strcasecmp(model, "TSEC"))
diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c
index eb3e65e..216e99a 100644
--- a/drivers/net/ethernet/freescale/ucc_geth.c
+++ b/drivers/net/ethernet/freescale/ucc_geth.c
@@ -3910,7 +3910,7 @@ static int ucc_geth_probe(struct platform_device* ofdev)
 	}
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 
 	ugeth->ug_info = ug_info;
diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c b/drivers/net/ethernet/hisilicon/hisi_femac.c
index 2c28088..96c32ae 100644
--- a/drivers/net/ethernet/hisilicon/hisi_femac.c
+++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
@@ -870,7 +870,7 @@ static int hisi_femac_drv_probe(struct platform_device *pdev)
 			   phy_modes(phy->interface));
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index e5d853b..b1cb58f 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -1229,7 +1229,7 @@ static int hix5hd2_dev_probe(struct platform_device *pdev)
 	}
 
 	mac_addr = of_get_mac_address(node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index d29104d..cda641e 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -478,7 +478,7 @@ static int xrx200_probe(struct platform_device *pdev)
 	}
 
 	mac = of_get_mac_address(np);
-	if (mac && is_valid_ether_addr(mac))
+	if (!IS_ERR(mac))
 		ether_addr_copy(net_dev->dev_addr, mac);
 	else
 		eth_hw_addr_random(net_dev);
diff --git a/drivers/net/ethernet/marvell/mv643xx_eth.c b/drivers/net/ethernet/marvell/mv643xx_eth.c
index 292a668..07e254f 100644
--- a/drivers/net/ethernet/marvell/mv643xx_eth.c
+++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
@@ -2749,7 +2749,7 @@ static int mv643xx_eth_shared_of_add_port(struct platform_device *pdev,
 	}
 
 	mac_addr = of_get_mac_address(pnp);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
 
 	mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c
index a715277..8186135 100644
--- a/drivers/net/ethernet/marvell/mvneta.c
+++ b/drivers/net/ethernet/marvell/mvneta.c
@@ -4563,7 +4563,7 @@ static int mvneta_probe(struct platform_device *pdev)
 	}
 
 	dt_mac_addr = of_get_mac_address(dn);
-	if (dt_mac_addr) {
+	if (!IS_ERR(dt_mac_addr)) {
 		mac_from = "device tree";
 		memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
 	} else {
diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c b/drivers/net/ethernet/marvell/pxa168_eth.c
index 35f2142..ce037e8 100644
--- a/drivers/net/ethernet/marvell/pxa168_eth.c
+++ b/drivers/net/ethernet/marvell/pxa168_eth.c
@@ -1461,7 +1461,7 @@ static int pxa168_eth_probe(struct platform_device *pdev)
 	if (pdev->dev.of_node)
 		mac_addr = of_get_mac_address(pdev->dev.of_node);
 
-	if (mac_addr && is_valid_ether_addr(mac_addr)) {
+	if (!IS_ERR_OR_NULL(mac_addr)) {
 		ether_addr_copy(dev->dev_addr, mac_addr);
 	} else {
 		/* try reading the mac address, if set by the bootloader */
diff --git a/drivers/net/ethernet/marvell/sky2.c b/drivers/net/ethernet/marvell/sky2.c
index 8b3495e..c4050ec 100644
--- a/drivers/net/ethernet/marvell/sky2.c
+++ b/drivers/net/ethernet/marvell/sky2.c
@@ -4808,7 +4808,7 @@ static struct net_device *sky2_init_netdev(struct sky2_hw *hw, unsigned port,
 	 * 2) from internal registers set by bootloader
 	 */
 	iap = of_get_mac_address(hw->pdev->dev.of_node);
-	if (iap)
+	if (!IS_ERR(iap))
 		memcpy(dev->dev_addr, iap, ETH_ALEN);
 	else
 		memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 + port * 8,
diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 53abe92..f9fbb3f 100644
--- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -2028,7 +2028,7 @@ static int __init mtk_init(struct net_device *dev)
 	const char *mac_addr;
 
 	mac_addr = of_get_mac_address(mac->of_node);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(dev->dev_addr, mac_addr);
 
 	/* If the mac address is invalid, use random mac address  */
diff --git a/drivers/net/ethernet/micrel/ks8851.c b/drivers/net/ethernet/micrel/ks8851.c
index 7849119..b44172a 100644
--- a/drivers/net/ethernet/micrel/ks8851.c
+++ b/drivers/net/ethernet/micrel/ks8851.c
@@ -425,7 +425,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
 	const u8 *mac_addr;
 
 	mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
-	if (mac_addr) {
+	if (!IS_ERR(mac_addr)) {
 		memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
 		ks8851_write_mac_addr(dev);
 		return;
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
index c946841..dc76b0d 100644
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
@@ -1327,7 +1327,7 @@ static int ks8851_probe(struct platform_device *pdev)
 	/* overwriting the default MAC address */
 	if (pdev->dev.of_node) {
 		mac = of_get_mac_address(pdev->dev.of_node);
-		if (mac)
+		if (!IS_ERR(mac))
 			memcpy(ks->mac_addr, mac, ETH_ALEN);
 	} else {
 		struct ks8851_mll_platform_data *pdata;
diff --git a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
index 89d1739..da138ed 100644
--- a/drivers/net/ethernet/nxp/lpc_eth.c
+++ b/drivers/net/ethernet/nxp/lpc_eth.c
@@ -1368,7 +1368,7 @@ static int lpc_eth_drv_probe(struct platform_device *pdev)
 
 	if (!is_valid_ether_addr(ndev->dev_addr)) {
 		const char *macaddr = of_get_mac_address(np);
-		if (macaddr)
+		if (!IS_ERR(macaddr))
 			memcpy(ndev->dev_addr, macaddr, ETH_ALEN);
 	}
 	if (!is_valid_ether_addr(ndev->dev_addr))
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 97f9295..b28360b 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -966,7 +966,7 @@
 
 	mac = of_get_mac_address(spi->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/qualcomm/qca_uart.c b/drivers/net/ethernet/qualcomm/qca_uart.c
index db6068c..5906168 100644
--- a/drivers/net/ethernet/qualcomm/qca_uart.c
+++ b/drivers/net/ethernet/qualcomm/qca_uart.c
@@ -351,7 +351,7 @@ static int qca_uart_probe(struct serdev_device *serdev)
 
 	mac = of_get_mac_address(serdev->dev.of_node);
 
-	if (mac)
+	if (!IS_ERR(mac))
 		ether_addr_copy(qca->net_dev->dev_addr, mac);
 
 	if (!is_valid_ether_addr(qca->net_dev->dev_addr)) {
diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9618c48..d3ffcf5 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -111,7 +111,7 @@ static void ravb_set_buffer_align(struct sk_buff *skb)
  */
 static void ravb_read_mac_address(struct net_device *ndev, const u8 *mac)
 {
-	if (mac) {
+	if (!IS_ERR(mac)) {
 		ether_addr_copy(ndev->dev_addr, mac);
 	} else {
 		u32 mahr = ravb_read(ndev, MAHR);
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e33af37..4d4be66 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data *sh_eth_parse_dt(struct device *dev)
 	pdata->phy_interface = ret;
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
 
 	pdata->no_ether_link =
diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
index fbd00cb..d2bc941 100644
--- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
+++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
@@ -124,7 +124,7 @@ static int sxgbe_platform_probe(struct platform_device *pdev)
 	}
 
 	/* Get MAC address if available (DT) */
-	if (mac)
+	if (!IS_ERR_OR_NULL(mac))
 		ether_addr_copy(priv->dev->dev_addr, mac);
 
 	/* Get the TX/RX IRQ numbers */
diff --git a/drivers/net/ethernet/socionext/sni_ave.c b/drivers/net/ethernet/socionext/sni_ave.c
index bb6d5fb..51a7b48 100644
--- a/drivers/net/ethernet/socionext/sni_ave.c
+++ b/drivers/net/ethernet/socionext/sni_ave.c
@@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
 	ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN + ETH_FCS_LEN);
 
 	mac_addr = of_get_mac_address(np);
-	if (mac_addr)
+	if (!IS_ERR(mac_addr))
 		ether_addr_copy(ndev->dev_addr, mac_addr);
 
 	/* if the mac address is invalid, use random mac address */
diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
index 5ab2733..5678b86 100644
--- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
+++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
@@ -4262,7 +4262,7 @@ int stmmac_dvr_probe(struct device *device,
 	priv->wol_irq = res->wol_irq;
 	priv->lpi_irq = res->lpi_irq;
 
-	if (res->mac)
+	if (!IS_ERR_OR_NULL(res->mac))
 		memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
 
 	dev_set_drvdata(device, priv->dev);
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index e376806..b18eeb0 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -2232,7 +2232,7 @@ static int cpsw_probe_dt(struct cpsw_platform_data *data,
 
 no_phy_slave:
 		mac_addr = of_get_mac_address(slave_node);
-		if (mac_addr) {
+		if (!IS_ERR(mac_addr)) {
 			memcpy(slave_data->mac_addr, mac_addr, ETH_ALEN);
 		} else {
 			ret = ti_cm_get_macid(&pdev->dev, i,
diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
index 01d4ca3..6428439 100644
--- a/drivers/net/ethernet/ti/netcp_core.c
+++ b/drivers/net/ethernet/ti/netcp_core.c
@@ -2037,7 +2037,7 @@ static int netcp_create_interface(struct netcp_device *netcp_device,
 		devm_release_mem_region(dev, res.start, size);
 	} else {
 		mac_addr = of_get_mac_address(node_interface);
-		if (mac_addr)
+		if (!IS_ERR(mac_addr))
 			ether_addr_copy(ndev->dev_addr, mac_addr);
 		else
 			eth_random_addr(ndev->dev_addr);
diff --git a/drivers/net/ethernet/wiznet/w5100.c b/drivers/net/ethernet/wiznet/w5100.c
index d8ba512..b0052933 100644
--- a/drivers/net/ethernet/wiznet/w5100.c
+++ b/drivers/net/ethernet/wiznet/w5100.c
@@ -1164,7 +1164,7 @@ int w5100_probe(struct device *dev, const struct w5100_ops *ops,
 	INIT_WORK(&priv->setrx_work, w5100_setrx_work);
 	INIT_WORK(&priv->restart_work, w5100_restart_work);
 
-	if (mac_addr)
+	if (!IS_ERR_OR_NULL(mac_addr))
 		memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
 	else
 		eth_hw_addr_random(ndev);
diff --git a/drivers/net/ethernet/xilinx/ll_temac_main.c b/drivers/net/ethernet/xilinx/ll_temac_main.c
index 9851991..f389a81 100644
--- a/drivers/net/ethernet/xilinx/ll_temac_main.c
+++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
@@ -1252,7 +1252,7 @@ static int temac_probe(struct platform_device *pdev)
 	if (temac_np) {
 		/* Retrieve the MAC address */
 		addr = of_get_mac_address(temac_np);
-		if (!addr) {
+		if (IS_ERR(addr)) {
 			dev_err(&pdev->dev, "could not find MAC address\n");
 			return -ENODEV;
 		}
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 4041c75..108fbc7 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -1596,7 +1596,7 @@ static int axienet_probe(struct platform_device *pdev)
 
 	/* Retrieve the MAC address */
 	mac_addr = of_get_mac_address(pdev->dev.of_node);
-	if (!mac_addr) {
+	if (IS_ERR(mac_addr)) {
 		dev_err(&pdev->dev, "could not find MAC address\n");
 		goto free_netdev;
 	}
diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
index fc38692..6911707 100644
--- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
+++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
@@ -1165,7 +1165,7 @@ static int xemaclite_of_probe(struct platform_device *ofdev)
 	lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
 	mac_address = of_get_mac_address(ofdev->dev.of_node);
 
-	if (mac_address) {
+	if (!IS_ERR(mac_address)) {
 		/* Set the MAC address. */
 		memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
 	} else {
diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c
index fddcee3..4b2b222 100644
--- a/net/ethernet/eth.c
+++ b/net/ethernet/eth.c
@@ -560,7 +560,7 @@ int eth_platform_get_mac_address(struct device *dev, u8 *mac_addr)
 	addr = NULL;
 	if (dp)
 		addr = of_get_mac_address(dp);
-	if (!addr)
+	if (IS_ERR_OR_NULL(addr))
 		addr = arch_get_platform_mac_address();
 
 	if (!addr)
-- 
1.9.1


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

* RE: [PATCH net-next v2 4/4] net: usb: smsc: fix warning reported by kbuild test robot
  2019-05-06 21:24 ` [PATCH net-next v2 4/4] net: usb: smsc: fix warning reported by kbuild test robot Petr Štetiar
@ 2019-05-06 21:29   ` Woojung.Huh
  0 siblings, 0 replies; 29+ messages in thread
From: Woojung.Huh @ 2019-05-06 21:29 UTC (permalink / raw)
  To: ynezz, netdev, davem, steve.glendinning, UNGLinuxDriver
  Cc: andrew, f.fainelli, hkallweit1, frowand.list, devel,
	linux-kernel, gregkh, maxime.ripard, linux-usb

> This patch fixes following warning reported by kbuild test robot:
> 
>  In function ‘memcpy’,
>      inlined from ‘smsc75xx_init_mac_address’ at drivers/net/usb/smsc75xx.c:778:3,
>      inlined from ‘smsc75xx_bind’ at drivers/net/usb/smsc75xx.c:1501:2:
>  ./include/linux/string.h:355:9: warning: argument 2 null where non-null expected [-Wnonnull]
>    return __builtin_memcpy(p, q, size);
>           ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
>  drivers/net/usb/smsc75xx.c: In function ‘smsc75xx_bind’:
>  ./include/linux/string.h:355:9: note: in a call to built-in function ‘__builtin_memcpy’
> 
> I've replaced the offending memcpy with ether_addr_copy, because I'm
> 100% sure, that of_get_mac_address can't return NULL as it returns valid
> pointer or ERR_PTR encoded value, nothing else.
> 
> I'm hesitant to just change IS_ERR into IS_ERR_OR_NULL check, as this
> would make the warning disappear also, but it would be confusing to
> check for impossible return value just to make a compiler happy.
> 
> Fixes: adfb3cb2c52e ("net: usb: support of_get_mac_address new ERR_PTR error")
> Reported-by: kbuild test robot <lkp@intel.com>
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---

Reviewed-by: Woojung Huh <woojung.huh@microchip.com>


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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-06 21:24 ` Petr Štetiar
  (?)
@ 2019-05-07  7:19   ` Dan Carpenter
  -1 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-05-07  7:19 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: netdev, David S. Miller, Matthias Brugger, devel, Andrew Lunn,
	Florian Fainelli, Maxime Ripard, Greg Kroah-Hartman,
	linux-kernel, linux-mediatek, Frank Rowand, linux-arm-kernel,
	Heiner Kallweit

On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> Hi,
> 
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.

I feel sort of ridiculous asking this over and over...  Maybe your spam
filter is eating my emails?

This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
"[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
looks like no one applied it.

You're acting as if it *was* applied but you refuse to answer my
question who applied it and which to which tree so I can figure out what
went wrong.

I only see comments from last Friday that it shouldn't be applied...  I
also told you on Friday in a different thread that that patch shouldn't
be applied.  Breaking git bisect is a bug, and we never do that.  I'm
just very confused right now...  What I'm trying to do is figure out in
my head how this process failed so we can do better next time.

regards,
dan carpenter


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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  7:19   ` Dan Carpenter
  0 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-05-07  7:19 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> Hi,
> 
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.

I feel sort of ridiculous asking this over and over...  Maybe your spam
filter is eating my emails?

This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
"[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
looks like no one applied it.

You're acting as if it *was* applied but you refuse to answer my
question who applied it and which to which tree so I can figure out what
went wrong.

I only see comments from last Friday that it shouldn't be applied...  I
also told you on Friday in a different thread that that patch shouldn't
be applied.  Breaking git bisect is a bug, and we never do that.  I'm
just very confused right now...  What I'm trying to do is figure out in
my head how this process failed so we can do better next time.

regards,
dan carpenter

_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  7:19   ` Dan Carpenter
  0 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-05-07  7:19 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> Hi,
> 
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.

I feel sort of ridiculous asking this over and over...  Maybe your spam
filter is eating my emails?

This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
"[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
looks like no one applied it.

You're acting as if it *was* applied but you refuse to answer my
question who applied it and which to which tree so I can figure out what
went wrong.

I only see comments from last Friday that it shouldn't be applied...  I
also told you on Friday in a different thread that that patch shouldn't
be applied.  Breaking git bisect is a bug, and we never do that.  I'm
just very confused right now...  What I'm trying to do is figure out in
my head how this process failed so we can do better next time.

regards,
dan carpenter


_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-07  7:19   ` Dan Carpenter
@ 2019-05-07  7:41     ` Greg Kroah-Hartman
  -1 siblings, 0 replies; 29+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-07  7:41 UTC (permalink / raw)
  To: Dan Carpenter, Petr Štetiar
  Cc: netdev, David S. Miller, Matthias Brugger, devel, Andrew Lunn,
	Florian Fainelli, Maxime Ripard, linux-kernel, linux-mediatek,
	Frank Rowand, linux-arm-kernel, Heiner Kallweit

On Tue, May 07, 2019 at 10:19:14AM +0300, Dan Carpenter wrote:
> On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> > Hi,
> > 
> > this patch series is an attempt to fix the mess, I've somehow managed to
> > introduce.
> > 
> > First patch in this series is defacto v5 of the previous 05/10 patch in the
> > series, but since the v4 of this 05/10 patch wasn't picked up by the
> > patchwork for some unknown reason, this patch wasn't applied with the other
> > 9 patches in the series, so I'm resending it as a separate patch of this
> > fixup series again.
> 
> I feel sort of ridiculous asking this over and over...  Maybe your spam
> filter is eating my emails?
> 
> This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
> "[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
> looks like no one applied it.
> 
> You're acting as if it *was* applied but you refuse to answer my
> question who applied it and which to which tree so I can figure out what
> went wrong.
> 
> I only see comments from last Friday that it shouldn't be applied...  I
> also told you on Friday in a different thread that that patch shouldn't
> be applied.  Breaking git bisect is a bug, and we never do that.  I'm
> just very confused right now...  What I'm trying to do is figure out in
> my head how this process failed so we can do better next time.

Just to resend this, so that it hopefully does _not_ get stuck in a spam
filter.

Petr, please address Dan's comments, do not ignore them.

greg k-h

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  7:41     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 29+ messages in thread
From: Greg Kroah-Hartman @ 2019-05-07  7:41 UTC (permalink / raw)
  To: Dan Carpenter, Petr Štetiar
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Matthias Brugger, Frank Rowand,
	David S. Miller, linux-arm-kernel, Heiner Kallweit

On Tue, May 07, 2019 at 10:19:14AM +0300, Dan Carpenter wrote:
> On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> > Hi,
> > 
> > this patch series is an attempt to fix the mess, I've somehow managed to
> > introduce.
> > 
> > First patch in this series is defacto v5 of the previous 05/10 patch in the
> > series, but since the v4 of this 05/10 patch wasn't picked up by the
> > patchwork for some unknown reason, this patch wasn't applied with the other
> > 9 patches in the series, so I'm resending it as a separate patch of this
> > fixup series again.
> 
> I feel sort of ridiculous asking this over and over...  Maybe your spam
> filter is eating my emails?
> 
> This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
> "[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
> looks like no one applied it.
> 
> You're acting as if it *was* applied but you refuse to answer my
> question who applied it and which to which tree so I can figure out what
> went wrong.
> 
> I only see comments from last Friday that it shouldn't be applied...  I
> also told you on Friday in a different thread that that patch shouldn't
> be applied.  Breaking git bisect is a bug, and we never do that.  I'm
> just very confused right now...  What I'm trying to do is figure out in
> my head how this process failed so we can do better next time.

Just to resend this, so that it hopefully does _not_ get stuck in a spam
filter.

Petr, please address Dan's comments, do not ignore them.

greg k-h

_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-07  7:19   ` Dan Carpenter
@ 2019-05-07  8:39     ` Petr Štetiar
  -1 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-07  8:39 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: netdev, David S. Miller, Matthias Brugger, devel, Andrew Lunn,
	Florian Fainelli, Maxime Ripard, Greg Kroah-Hartman,
	linux-kernel, linux-mediatek, Frank Rowand, linux-arm-kernel,
	Heiner Kallweit

Dan Carpenter <dan.carpenter@oracle.com> [2019-05-07 10:19:14]:

Hi,

> On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> > 
> > this patch series is an attempt to fix the mess, I've somehow managed to
> > introduce.
> > 
> > First patch in this series is defacto v5 of the previous 05/10 patch in the
> > series, but since the v4 of this 05/10 patch wasn't picked up by the
> > patchwork for some unknown reason, this patch wasn't applied with the other
> > 9 patches in the series, so I'm resending it as a separate patch of this
> > fixup series again.
> 
> I feel sort of ridiculous asking this over and over...  Maybe your spam
> filter is eating my emails?

nope, I've read your email, that's the only reason I've sent out this v2 which
added Fixes: tag you've suggested in your email.

> This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
> "[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
> looks like no one applied it.

this patch series is against net-next, and I've added Fixes: tag as you've
requested in this v2 series[1] (which expands to commit[2] in net-next):

 Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")

> You're acting as if it *was* applied but you refuse to answer my
> question who applied it and which to which tree so I can figure out what
> went wrong.

it was applied[2] to David's net-next tree, but unfortunately partialy, just 9
patches out of 10, as the patch 05/10 in that series (which is patch 1/4 in
this series) never reached netdev mailing list and patchwork, probably because
of some netdev mailing list software and/or patchwork hiccup, very likely due
to the long list of recipients in that patch and as I'm not subscribed to the
netdev (due to the high traffic) I'm probably treaten somehow differently.

So to sum it up, I've simply thought, that it was enough to send out v2 with
that Fixes: tag and considered it done.

> I only see comments from last Friday that it shouldn't be applied...

I'm sorry, but which comments do you mean exactly? Those about the
`nvmem-mac-address` DT (sysfs) entry? If that is the case, from my point of
view, I've provided reasonable arguments and nobody told me, that I'm wrong
with my reasoning or NACKed this explicitly, so David probably considered my
arguments good enough and merged it as it is? I don't have any other
explanation.

> I also told you on Friday in a different thread that that patch shouldn't be
> applied.  Breaking git bisect is a bug, and we never do that. 

Yes, and I agree with you, but I've simply thought, that if any of the
maintainers who previously reviewed the series didn't objected about this,
that they're possibly going to squash those patches by themselves during the
merging process or that they're going to tell me to do so and I would address
this in the latest interation of the patchset before merge.

Anyway, is there any possibility how to fix that now?

> I'm just very confused right now.  What I'm trying to do is figure out in
> my head how this process failed so we can do better next time.

I'm just occasional contributor, so I'm sorry, but I can hardly provide any
input.

1. https://patchwork.ozlabs.org/patch/1096054/
2. https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=d01f449c008a3f41fa44c603e28a7452ab8f8e68

Cheers,

Petr

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  8:39     ` Petr Štetiar
  0 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-07  8:39 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

Dan Carpenter <dan.carpenter@oracle.com> [2019-05-07 10:19:14]:

Hi,

> On Mon, May 06, 2019 at 11:24:43PM +0200, Petr Štetiar wrote:
> > 
> > this patch series is an attempt to fix the mess, I've somehow managed to
> > introduce.
> > 
> > First patch in this series is defacto v5 of the previous 05/10 patch in the
> > series, but since the v4 of this 05/10 patch wasn't picked up by the
> > patchwork for some unknown reason, this patch wasn't applied with the other
> > 9 patches in the series, so I'm resending it as a separate patch of this
> > fixup series again.
> 
> I feel sort of ridiculous asking this over and over...  Maybe your spam
> filter is eating my emails?

nope, I've read your email, that's the only reason I've sent out this v2 which
added Fixes: tag you've suggested in your email.

> This bug was introduced in https://patchwork.ozlabs.org/patch/1094916/
> "[v4,01/10] of_net: add NVMEM support to of_get_mac_address" but it
> looks like no one applied it.

this patch series is against net-next, and I've added Fixes: tag as you've
requested in this v2 series[1] (which expands to commit[2] in net-next):

 Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")

> You're acting as if it *was* applied but you refuse to answer my
> question who applied it and which to which tree so I can figure out what
> went wrong.

it was applied[2] to David's net-next tree, but unfortunately partialy, just 9
patches out of 10, as the patch 05/10 in that series (which is patch 1/4 in
this series) never reached netdev mailing list and patchwork, probably because
of some netdev mailing list software and/or patchwork hiccup, very likely due
to the long list of recipients in that patch and as I'm not subscribed to the
netdev (due to the high traffic) I'm probably treaten somehow differently.

So to sum it up, I've simply thought, that it was enough to send out v2 with
that Fixes: tag and considered it done.

> I only see comments from last Friday that it shouldn't be applied...

I'm sorry, but which comments do you mean exactly? Those about the
`nvmem-mac-address` DT (sysfs) entry? If that is the case, from my point of
view, I've provided reasonable arguments and nobody told me, that I'm wrong
with my reasoning or NACKed this explicitly, so David probably considered my
arguments good enough and merged it as it is? I don't have any other
explanation.

> I also told you on Friday in a different thread that that patch shouldn't be
> applied.  Breaking git bisect is a bug, and we never do that. 

Yes, and I agree with you, but I've simply thought, that if any of the
maintainers who previously reviewed the series didn't objected about this,
that they're possibly going to squash those patches by themselves during the
merging process or that they're going to tell me to do so and I would address
this in the latest interation of the patchset before merge.

Anyway, is there any possibility how to fix that now?

> I'm just very confused right now.  What I'm trying to do is figure out in
> my head how this process failed so we can do better next time.

I'm just occasional contributor, so I'm sorry, but I can hardly provide any
input.

1. https://patchwork.ozlabs.org/patch/1096054/
2. https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git/commit/?id=d01f449c008a3f41fa44c603e28a7452ab8f8e68

Cheers,

Petr

_______________________________________________
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] 29+ messages in thread

* netdev patchwork issues [Was: Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes]
  2019-05-07  8:39     ` Petr Štetiar
@ 2019-05-07  9:01       ` Petr Štetiar
  -1 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-07  9:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: netdev, David S. Miller, Matthias Brugger, devel, Andrew Lunn,
	Florian Fainelli, Maxime Ripard, Greg Kroah-Hartman,
	linux-kernel, linux-mediatek, Frank Rowand, linux-arm-kernel,
	Heiner Kallweit, Jeremy Kerr

Petr Štetiar <ynezz@true.cz> [2019-05-07 10:39:18]:

[adding Jeremy to the Cc: loop]

> it was applied[2] to David's net-next tree, but unfortunately partialy, just 9
> patches out of 10, as the patch 05/10 in that series (which is patch 1/4 in
> this series) never reached netdev mailing list and patchwork, probably because
> of some netdev mailing list software and/or patchwork hiccup, very likely due
> to the long list of recipients in that patch and as I'm not subscribed to the
> netdev (due to the high traffic) I'm probably treaten somehow differently.

For the record, I've following in my ~/.gitconfig:

 [sendemail.linux]
    tocmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol"
    cccmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom"

and I've sent the patches with the following command:

 git send-email \
	--to netdev@vger.kernel.org \
	--to 'David S. Miller <davem@davemloft.net>' \
	--cc 'Andrew Lunn <andrew@lunn.ch>' \
	--cc 'Florian Fainelli <f.fainelli@gmail.com>' \
	--cc 'Heiner Kallweit <hkallweit1@gmail.com>' \
	--cc 'Frank Rowand <frowand.list@gmail.com>' \
	--cc 'devel@driverdev.osuosl.org' \
	--cc 'linux-kernel@vger.kernel.org' \
	--cc 'Greg Kroah-Hartman <gregkh@linuxfoundation.org>' \
	--cc 'Maxime Ripard <maxime.ripard@bootlin.com>' \
	--identity linux tmp/nvmem-fix-v2/000*

which resulted just in the following 4 bounces:

 * nbd@openwrt.org (no such recipient)
 * ks.giri@samsung.com (no such recipient)
 * vipul.pandya@samsung.com (no such recipient)

 Your mail to 'linux-arm-kernel' with the subject

    [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error

 Is being held until the list moderator can review it for approval.  The reason
 it is being held:

    Too many recipients to the message

So maybe netdev have similar moderation stuff enabled, but doesn't send out
this notices back? I've "fixed" the issue with the following workaround:

 git send-email \
 	--to netdev@vger.kernel.org \
	--in-reply-to '<1557177887-30446-1-git-send-email-ynezz@true.cz>' \
	tmp/nvmem-fix-v2/0001-net-ethernet-support-of_get_mac_address-new-ERR_PTR-.patch

That is, just using netdev as the sole recipient and then the patch has
appeared in the patchwork and in the mailing list archive as well.

-- ynezz

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

* netdev patchwork issues [Was: Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes]
@ 2019-05-07  9:01       ` Petr Štetiar
  0 siblings, 0 replies; 29+ messages in thread
From: Petr Štetiar @ 2019-05-07  9:01 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Jeremy Kerr, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

Petr Štetiar <ynezz@true.cz> [2019-05-07 10:39:18]:

[adding Jeremy to the Cc: loop]

> it was applied[2] to David's net-next tree, but unfortunately partialy, just 9
> patches out of 10, as the patch 05/10 in that series (which is patch 1/4 in
> this series) never reached netdev mailing list and patchwork, probably because
> of some netdev mailing list software and/or patchwork hiccup, very likely due
> to the long list of recipients in that patch and as I'm not subscribed to the
> netdev (due to the high traffic) I'm probably treaten somehow differently.

For the record, I've following in my ~/.gitconfig:

 [sendemail.linux]
    tocmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nol"
    cccmd ="`pwd`/scripts/get_maintainer.pl --nogit --nogit-fallback --norolestats --nom"

and I've sent the patches with the following command:

 git send-email \
	--to netdev@vger.kernel.org \
	--to 'David S. Miller <davem@davemloft.net>' \
	--cc 'Andrew Lunn <andrew@lunn.ch>' \
	--cc 'Florian Fainelli <f.fainelli@gmail.com>' \
	--cc 'Heiner Kallweit <hkallweit1@gmail.com>' \
	--cc 'Frank Rowand <frowand.list@gmail.com>' \
	--cc 'devel@driverdev.osuosl.org' \
	--cc 'linux-kernel@vger.kernel.org' \
	--cc 'Greg Kroah-Hartman <gregkh@linuxfoundation.org>' \
	--cc 'Maxime Ripard <maxime.ripard@bootlin.com>' \
	--identity linux tmp/nvmem-fix-v2/000*

which resulted just in the following 4 bounces:

 * nbd@openwrt.org (no such recipient)
 * ks.giri@samsung.com (no such recipient)
 * vipul.pandya@samsung.com (no such recipient)

 Your mail to 'linux-arm-kernel' with the subject

    [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error

 Is being held until the list moderator can review it for approval.  The reason
 it is being held:

    Too many recipients to the message

So maybe netdev have similar moderation stuff enabled, but doesn't send out
this notices back? I've "fixed" the issue with the following workaround:

 git send-email \
 	--to netdev@vger.kernel.org \
	--in-reply-to '<1557177887-30446-1-git-send-email-ynezz@true.cz>' \
	tmp/nvmem-fix-v2/0001-net-ethernet-support-of_get_mac_address-new-ERR_PTR-.patch

That is, just using netdev as the sole recipient and then the patch has
appeared in the patchwork and in the mailing list archive as well.

-- ynezz

_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-06 21:24 ` Petr Štetiar
@ 2019-05-07  9:07   ` Geert Uytterhoeven
  -1 siblings, 0 replies; 29+ messages in thread
From: Geert Uytterhoeven @ 2019-05-07  9:07 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: netdev, David S. Miller, Matthias Brugger, driverdevel,
	Andrew Lunn, Florian Fainelli, Maxime Ripard, Greg Kroah-Hartman,
	Linux Kernel Mailing List, linux-mediatek, Frank Rowand,
	Linux ARM, Heiner Kallweit, Linux-Renesas

Hi Petr,

On Mon, May 6, 2019 at 11:25 PM Petr Štetiar <ynezz@true.cz> wrote:
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
>
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
>
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
>
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
>
> Fourth patch fixes warning reported by kbuild test robot.
>
> Cheers,
>
> Petr
>
> Petr Štetiar (4):
>   net: ethernet: support of_get_mac_address new ERR_PTR error

I didn't receive the patch through email, but patchwork does have it:
https://patchwork.ozlabs.org/patch/1096054/

This fixes the crash ("Unable to handle kernel paging request atvirtual
address fffffffe") I'm seeing with sh_eth on r8a7791/koelsch, so

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  9:07   ` Geert Uytterhoeven
  0 siblings, 0 replies; 29+ messages in thread
From: Geert Uytterhoeven @ 2019-05-07  9:07 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: driverdevel, Andrew Lunn, Florian Fainelli, Maxime Ripard,
	netdev, Linux Kernel Mailing List, Linux-Renesas, linux-mediatek,
	Greg Kroah-Hartman, Matthias Brugger, Frank Rowand,
	David S. Miller, Linux ARM, Heiner Kallweit

Hi Petr,

On Mon, May 6, 2019 at 11:25 PM Petr Štetiar <ynezz@true.cz> wrote:
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
>
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
>
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
>
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
>
> Fourth patch fixes warning reported by kbuild test robot.
>
> Cheers,
>
> Petr
>
> Petr Štetiar (4):
>   net: ethernet: support of_get_mac_address new ERR_PTR error

I didn't receive the patch through email, but patchwork does have it:
https://patchwork.ozlabs.org/patch/1096054/

This fixes the crash ("Unable to handle kernel paging request atvirtual
address fffffffe") I'm seeing with sh_eth on r8a7791/koelsch, so

Tested-by: Geert Uytterhoeven <geert+renesas@glider.be>

Gr{oetje,eeting}s,

                        Geert

-- 
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-07  8:39     ` Petr Štetiar
@ 2019-05-07  9:44       ` Dan Carpenter
  -1 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-05-07  9:44 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

Oh crap.  You did add a Fixes tag.  My bad.

I should have been more clear/pro-active on Friday and we could have
avoided this...  Next time.

regards,
dan carpenter

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07  9:44       ` Dan Carpenter
  0 siblings, 0 replies; 29+ messages in thread
From: Dan Carpenter @ 2019-05-07  9:44 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: devel, Andrew Lunn, Florian Fainelli, Maxime Ripard, netdev,
	linux-kernel, linux-mediatek, Greg Kroah-Hartman,
	Matthias Brugger, Frank Rowand, David S. Miller,
	linux-arm-kernel, Heiner Kallweit

Oh crap.  You did add a Fixes tag.  My bad.

I should have been more clear/pro-active on Friday and we could have
avoided this...  Next time.

regards,
dan carpenter

_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-06 21:24 ` Petr Štetiar
@ 2019-05-07 12:14   ` Leonard Crestez
  -1 siblings, 0 replies; 29+ messages in thread
From: Leonard Crestez @ 2019-05-07 12:14 UTC (permalink / raw)
  To: Petr Štetiar, netdev, David S. Miller
  Cc: Matthias Brugger, Andrew Lunn, Florian Fainelli, Heiner Kallweit,
	Frank Rowand, linux-kernel, Greg Kroah-Hartman, linux-arm-kernel,
	dl-linux-imx

On 07.05.2019 00:25, Petr Štetiar wrote:
> Hi,
> 
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
> 
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
> 
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
> 
> Fourth patch fixes warning reported by kbuild test robot.
> 
> Cheers,
> 
> Petr
> 
> Petr Štetiar (4):
>    net: ethernet: support of_get_mac_address new ERR_PTR error
>    net: dsa: support of_get_mac_address new ERR_PTR error
>    staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
>    net: usb: smsc: fix warning reported by kbuild test robot

>   drivers/net/ethernet/freescale/fec_main.c             | 2 +-

This fixes netboot on imx (probably all of them).

Tested-by: Leonard Crestez <leonard.crestez@nxp.com>

But shouldn't "support of_get_mac_address new ERR_PTR error" somehow be 
reordered so that it's done before allowing non-null errors from 
of_get_mac_address?

Otherwise it will break bisect for many people.

--
Regards,
Leonard

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07 12:14   ` Leonard Crestez
  0 siblings, 0 replies; 29+ messages in thread
From: Leonard Crestez @ 2019-05-07 12:14 UTC (permalink / raw)
  To: Petr Štetiar, netdev, David S. Miller
  Cc: Andrew Lunn, Florian Fainelli, Greg Kroah-Hartman, linux-kernel,
	dl-linux-imx, Matthias Brugger, Frank Rowand, linux-arm-kernel,
	Heiner Kallweit

On 07.05.2019 00:25, Petr Štetiar wrote:
> Hi,
> 
> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
> 
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
> 
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
> 
> Fourth patch fixes warning reported by kbuild test robot.
> 
> Cheers,
> 
> Petr
> 
> Petr Štetiar (4):
>    net: ethernet: support of_get_mac_address new ERR_PTR error
>    net: dsa: support of_get_mac_address new ERR_PTR error
>    staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check
>    net: usb: smsc: fix warning reported by kbuild test robot

>   drivers/net/ethernet/freescale/fec_main.c             | 2 +-

This fixes netboot on imx (probably all of them).

Tested-by: Leonard Crestez <leonard.crestez@nxp.com>

But shouldn't "support of_get_mac_address new ERR_PTR error" somehow be 
reordered so that it's done before allowing non-null errors from 
of_get_mac_address?

Otherwise it will break bisect for many people.

--
Regards,
Leonard

_______________________________________________
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] 29+ messages in thread

* Re: [PATCH net-next v2 2/4] net: dsa: support of_get_mac_address new ERR_PTR error
  2019-05-06 21:24 ` [PATCH net-next v2 2/4] net: dsa: " Petr Štetiar
@ 2019-05-07 13:49   ` Vladimir Oltean
  0 siblings, 0 replies; 29+ messages in thread
From: Vladimir Oltean @ 2019-05-07 13:49 UTC (permalink / raw)
  To: Petr Štetiar
  Cc: netdev, David S. Miller, Andrew Lunn, Vivien Didelot,
	Florian Fainelli, Heiner Kallweit, Frank Rowand, devel,
	linux-kernel, Greg Kroah-Hartman, Maxime Ripard

On Tue, 7 May 2019 at 00:26, Petr Štetiar <ynezz@true.cz> wrote:
>
> There was NVMEM support added to of_get_mac_address, so it could now
> return ERR_PTR encoded error values, so we need to adjust all current
> users of of_get_mac_address to this new fact.
>
> While at it, remove superfluous is_valid_ether_addr as the MAC address
> returned from of_get_mac_address is always valid and checked by
> is_valid_ether_addr anyway.
>
> Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
> Signed-off-by: Petr Štetiar <ynezz@true.cz>
> ---
>  net/dsa/slave.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/net/dsa/slave.c b/net/dsa/slave.c
> index 316bce9..fe7b6a6 100644
> --- a/net/dsa/slave.c
> +++ b/net/dsa/slave.c
> @@ -1418,7 +1418,7 @@ int dsa_slave_create(struct dsa_port *port)
>                                 NETIF_F_HW_VLAN_CTAG_FILTER;
>         slave_dev->hw_features |= NETIF_F_HW_TC;
>         slave_dev->ethtool_ops = &dsa_slave_ethtool_ops;
> -       if (port->mac && is_valid_ether_addr(port->mac))
> +       if (!IS_ERR_OR_NULL(port->mac))
>                 ether_addr_copy(slave_dev->dev_addr, port->mac);
>         else
>                 eth_hw_addr_inherit(slave_dev, master);
> --
> 1.9.1
>

Tested-by: Vladimir Oltean <olteanv@gmail.com>

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
  2019-05-06 21:24 ` Petr Štetiar
@ 2019-05-07 19:23   ` David Miller
  -1 siblings, 0 replies; 29+ messages in thread
From: David Miller @ 2019-05-07 19:23 UTC (permalink / raw)
  To: ynezz
  Cc: netdev, matthias.bgg, andrew, f.fainelli, hkallweit1,
	frowand.list, devel, linux-kernel, gregkh, maxime.ripard,
	linux-arm-kernel, linux-mediatek

From: Petr Štetiar <ynezz@true.cz>
Date: Mon,  6 May 2019 23:24:43 +0200

> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
> 
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
> 
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
> 
> Fourth patch fixes warning reported by kbuild test robot.

Series applied, thanks.

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

* Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes
@ 2019-05-07 19:23   ` David Miller
  0 siblings, 0 replies; 29+ messages in thread
From: David Miller @ 2019-05-07 19:23 UTC (permalink / raw)
  To: ynezz
  Cc: devel, andrew, f.fainelli, maxime.ripard, netdev, linux-kernel,
	linux-mediatek, gregkh, matthias.bgg, frowand.list,
	linux-arm-kernel, hkallweit1

From: Petr Štetiar <ynezz@true.cz>
Date: Mon,  6 May 2019 23:24:43 +0200

> this patch series is an attempt to fix the mess, I've somehow managed to
> introduce.
> 
> First patch in this series is defacto v5 of the previous 05/10 patch in the
> series, but since the v4 of this 05/10 patch wasn't picked up by the
> patchwork for some unknown reason, this patch wasn't applied with the other
> 9 patches in the series, so I'm resending it as a separate patch of this
> fixup series again.
> 
> Second patch is a result of this rebase against net-next tree, where I was
> checking again all current users of of_get_mac_address and found out, that
> there's new one in DSA, so I've converted this user to the new ERR_PTR
> encoded error value as well.
> 
> Third patch which was sent as v5 wasn't considered for merge, but I still
> think, that we need to check for possible NULL value, thus current IS_ERR
> check isn't sufficient and we need to use IS_ERR_OR_NULL instead.
> 
> Fourth patch fixes warning reported by kbuild test robot.

Series applied, thanks.

_______________________________________________
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] 29+ messages in thread

* RE: [EXT] [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error
  2019-05-06 21:24   ` Petr Štetiar
@ 2019-05-08  3:07       ` Andy Duan
  -1 siblings, 0 replies; 29+ messages in thread
From: Andy Duan @ 2019-05-08  3:07 UTC (permalink / raw)
  To: Petr Štetiar, netdev-u79uwXL29TY76Z2rM5mHXA,
	David S. Miller, Andreas Larsson, Maxime Ripard, Chen-Yu Tsai,
	Thor Thayer, Florian Fainelli, Doug Berger, Sunil Goutham,
	Robert Richter, Madalin-cristian Bucur, Pantelis Antoniou,
	Claudiu Manoil, Leo Li, Yisen Zhuang, Salil Mehta,
	Hauke Mehrtens, Sebastian Hesselbarth, Thomas Petazzoni,
	Mirko Lindner
  Cc: devel-gWbeCf7V1WCQmaza687I9mD2FQJk+8+b, Andrew Lunn,
	Greg Kroah-Hartman, linuxppc-dev-uLR06cmDAlY/bJ5BZ2RsiQ,
	linux-mediatek-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA,
	linux-renesas-soc-u79uwXL29TY76Z2rM5mHXA,
	bcm-kernel-feedback-list-dY08KVG/lbpWk0Htik3J/w,
	nios2-dev-g9ZBwUv/Ih/yUk5EbOjzuce+I+R0W71w,
	linux-omap-u79uwXL29TY76Z2rM5mHXA, Frank Rowand,
	linux-stm32-XDFAJ8BFU24N7RejjzZ/Li2xQDfSxrLKVpNB7YpNyf8,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
	Heiner Kallweit

From: Petr Štetiar <ynezz@true.cz> Sent: Tuesday, May 7, 2019 5:25 AM
> There was NVMEM support added to of_get_mac_address, so it could now
> return ERR_PTR encoded error values, so we need to adjust all current users
> of of_get_mac_address to this new fact.
> 
> While at it, remove superfluous is_valid_ether_addr as the MAC address
> returned from of_get_mac_address is always valid and checked by
> is_valid_ether_addr anyway.
> 
> Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
> Signed-off-by: Petr Štetiar <ynezz@true.cz>

Test the patch on i.MX8MQ platform that fix the mem abort issue that is introduced in next-190507.

Tested-by: Fugang Duan <fugang.duan@nxp.com>
> ---
> 
>  This is defacto v5 of the previous 05/10 patch in the series, but since the
>  v4 of this 05/10 patch wasn't picked up by the patchwork for some unknown
> reason, this patch wasn't applied with the other 9 patches in the series, so
> I'm resending it as a separate patch of this fixup series.
> 
>  Changes since v1:
> 
>   * added Fixes: tag
> 
>  Previous changelog (Patch 05/10):
> 
>   Changes since v3:
> 
>    * IS_ERR_OR_NULL -> IS_ERR
> 
>   Changes since v4:
> 
>    * I've just blindly replaced IS_ERR_OR_NULL with IS_ERR, but I've just
>      realized, that in some cases we still need to check for NULL, so I've
>      corrected it in following drivers/files:
> 
>       - broadcom/bgmac-bcma.c
>       - marvell/pxa168_eth.c
>       - samsung/sxgbe/sxgbe_platform.c
>       - stmicro/stmmac/stmmac_main.c
>       - wiznet/w5100.c
>       - ethernet/eth.c
> 
>  drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
>  drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
>  drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
>  drivers/net/ethernet/arc/emac_main.c                  | 2 +-
>  drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
>  drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
>  drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
>  drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
>  drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
>  drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
>  drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
>  drivers/net/ethernet/ethoc.c                          | 2 +-
>  drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
>  drivers/net/ethernet/freescale/fec_main.c             | 2 +-
>  drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
>  drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
>  drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
>  drivers/net/ethernet/freescale/gianfar.c              | 2 +-
>  drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
>  drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
>  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
>  drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
>  drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
>  drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
>  drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
>  drivers/net/ethernet/marvell/sky2.c                   | 2 +-
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
>  drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
>  drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
>  drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
>  drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
>  drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
>  drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
>  drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
>  drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
>  drivers/net/ethernet/ti/cpsw.c                        | 2 +-
>  drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
>  drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
>  drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
>  net/ethernet/eth.c                                    | 2 +-
>  45 files changed, 45 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/net/ethernet/aeroflex/greth.c
> b/drivers/net/ethernet/aeroflex/greth.c
> index 47e5984..7c5cf02 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device
> *ofdev)
>                 const u8 *addr;
> 
>                 addr = of_get_mac_address(ofdev->dev.of_node);
> -               if (addr) {
> +               if (!IS_ERR(addr)) {
>                         for (i = 0; i < 6; i++)
>                                 macaddr[i] = (unsigned int) addr[i];
>                 } else {
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c
> b/drivers/net/ethernet/allwinner/sun4i-emac.c
> index e1acafa..37ebd89 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
> 
>         /* Read MAC-address from DT */
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
> 
>         /* Check if the MAC address is valid, if not get a random one */ diff
> --git a/drivers/net/ethernet/altera/altera_tse_main.c
> b/drivers/net/ethernet/altera/altera_tse_main.c
> index aa1d1f5..877e67f 100644
> --- a/drivers/net/ethernet/altera/altera_tse_main.c
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
> @@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device
> *pdev)
> 
>         /* get default MAC address from device tree */
>         macaddr = of_get_mac_address(pdev->dev.of_node);
> -       if (macaddr)
> +       if (!IS_ERR(macaddr))
>                 ether_addr_copy(ndev->dev_addr, macaddr);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/arc/emac_main.c
> b/drivers/net/ethernet/arc/emac_main.c
> index ff3d685..7f89ad5 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
> @@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int
> interface)
>         /* Get MAC address from device tree */
>         mac_addr = of_get_mac_address(dev->of_node);
> 
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/aurora/nb8800.c
> b/drivers/net/ethernet/aurora/nb8800.c
> index f62deeb..3c4967e 100644
> --- a/drivers/net/ethernet/aurora/nb8800.c
> +++ b/drivers/net/ethernet/aurora/nb8800.c
> @@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device
> *pdev)
>         dev->irq = irq;
> 
>         mac = of_get_mac_address(pdev->dev.of_node);
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(dev->dev_addr))
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c
> b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 4e87a30..c623896 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -2505,7 +2505,7 @@ static int bcm_sysport_probe(struct
> platform_device *pdev)
> 
>         /* Initialize netdevice members */
>         macaddr = of_get_mac_address(dn);
> -       if (!macaddr || !is_valid_ether_addr(macaddr)) {
> +       if (IS_ERR(macaddr)) {
>                 dev_warn(&pdev->dev, "using random Ethernet MAC\n");
>                 eth_hw_addr_random(dev);
>         } else {
> diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c
> b/drivers/net/ethernet/broadcom/bgmac-bcma.c
> index 6fe074c..34d1830 100644
> --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
> +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
> @@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
>                 mac = of_get_mac_address(bgmac->dev->of_node);
> 
>         /* If no MAC address assigned via device tree, check SPROM */
> -       if (!mac) {
> +       if (IS_ERR_OR_NULL(mac)) {
>                 switch (core->core_unit) {
>                 case 0:
>                         mac = sprom->et0mac; diff --git
> a/drivers/net/ethernet/broadcom/bgmac-platform.c
> b/drivers/net/ethernet/broadcom/bgmac-platform.c
> index 894eda5..6dc0dd9 100644
> --- a/drivers/net/ethernet/broadcom/bgmac-platform.c
> +++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
> @@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
>         bgmac->dma_dev = &pdev->dev;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(bgmac->net_dev->dev_addr,
> mac_addr);
>         else
>                 dev_warn(&pdev->dev, "MAC address not present in
> device tree\n"); diff --git
> a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 4fd9735..374b9ff 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device
> *pdev)
> 
>         if (dn) {
>                 macaddr = of_get_mac_address(dn);
> -               if (!macaddr) {
> +               if (IS_ERR(macaddr)) {
>                         dev_err(&pdev->dev, "can't find MAC
> address\n");
>                         err = -EINVAL;
>                         goto err;
> diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> index 5359c10..15b1130 100644
> --- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> +++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> @@ -1503,7 +1503,7 @@ static int octeon_mgmt_probe(struct
> platform_device *pdev)
> 
>         mac = of_get_mac_address(pdev->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 memcpy(netdev->dev_addr, mac, ETH_ALEN);
>         else
>                 eth_hw_addr_random(netdev); diff --git
> a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> index 81c281a..a65be85 100644
> --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> @@ -1484,7 +1484,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
>                         break;
> 
>                 mac = of_get_mac_address(node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         ether_addr_copy(bgx->lmac[lmac].mac, mac);
> 
>                 SET_NETDEV_DEV(&bgx->lmac[lmac].netdev,
> &bgx->pdev->dev); diff --git a/drivers/net/ethernet/davicom/dm9000.c
> b/drivers/net/ethernet/davicom/dm9000.c
> index c2586f4..953ee56 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
> @@ -1412,7 +1412,7 @@ static struct dm9000_plat_data
> *dm9000_parse_dt(struct device *dev)
>                 pdata->flags |= DM9000_PLATF_NO_EEPROM;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(pdata->dev_addr, mac_addr,
> sizeof(pdata->dev_addr));
> 
>         return pdata;
> diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
> index 0f3e7f2..71da049 100644
> --- a/drivers/net/ethernet/ethoc.c
> +++ b/drivers/net/ethernet/ethoc.c
> @@ -1153,7 +1153,7 @@ static int ethoc_probe(struct platform_device
> *pdev)
>                 const void *mac;
> 
>                 mac = of_get_mac_address(pdev->dev.of_node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         ether_addr_copy(netdev->dev_addr, mac);
>                 priv->phy_id = -1;
>         }
> diff --git a/drivers/net/ethernet/ezchip/nps_enet.c
> b/drivers/net/ethernet/ezchip/nps_enet.c
> index 659f1ad..b4ce261 100644
> --- a/drivers/net/ethernet/ezchip/nps_enet.c
> +++ b/drivers/net/ethernet/ezchip/nps_enet.c
> @@ -616,7 +616,7 @@ static s32 nps_enet_probe(struct platform_device
> *pdev)
> 
>         /* set kernel MAC address to dev */
>         mac_addr = of_get_mac_address(dev->of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index a96ad20..aa7d4e2 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1655,7 +1655,7 @@ static void fec_get_mac(struct net_device *ndev)
>                 struct device_node *np = fep->pdev->dev.of_node;
>                 if (np) {
>                         const char *mac = of_get_mac_address(np);
> -                       if (mac)
> +                       if (!IS_ERR(mac))
>                                 iap = (unsigned char *) mac;
>                 }
>         }
> diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c
> b/drivers/net/ethernet/freescale/fec_mpc52xx.c
> index c1968b3..7b7e526 100644
> --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
> +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
> @@ -902,7 +902,7 @@ static int mpc52xx_fec_probe(struct platform_device
> *op)
>          * First try to read MAC address from DT
>          */
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr) {
> +       if (!IS_ERR(mac_addr)) {
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         } else {
>                 struct mpc52xx_fec __iomem *fec = priv->fec; diff --git
> a/drivers/net/ethernet/freescale/fman/mac.c
> b/drivers/net/ethernet/freescale/fman/mac.c
> index 3c21486..9cd2c28 100644
> --- a/drivers/net/ethernet/freescale/fman/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac.c
> @@ -724,7 +724,7 @@ static int mac_probe(struct platform_device
> *_of_dev)
> 
>         /* Get the MAC address */
>         mac_addr = of_get_mac_address(mac_node);
> -       if (!mac_addr) {
> +       if (IS_ERR(mac_addr)) {
>                 dev_err(dev, "of_get_mac_address(%pOF) failed\n",
> mac_node);
>                 err = -EINVAL;
>                 goto _return_of_get_parent; diff --git
> a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> index 7c548ed..90ea7a1 100644
> --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> @@ -1014,7 +1014,7 @@ static int fs_enet_probe(struct platform_device
> *ofdev)
>         spin_lock_init(&fep->tx_lock);
> 
>         mac_addr = of_get_mac_address(ofdev->dev.of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
> 
>         ret = fep->ops->allocate_bd(ndev); diff --git
> a/drivers/net/ethernet/freescale/gianfar.c
> b/drivers/net/ethernet/freescale/gianfar.c
> index 45fcc96..df13c69 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -872,7 +872,7 @@ static int gfar_of_init(struct platform_device *ofdev,
> struct net_device **pdev)
> 
>         mac_addr = of_get_mac_address(np);
> 
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
> 
>         if (model && !strcasecmp(model, "TSEC")) diff --git
> a/drivers/net/ethernet/freescale/ucc_geth.c
> b/drivers/net/ethernet/freescale/ucc_geth.c
> index eb3e65e..216e99a 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3910,7 +3910,7 @@ static int ucc_geth_probe(struct platform_device*
> ofdev)
>         }
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
> 
>         ugeth->ug_info = ug_info;
> diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c
> b/drivers/net/ethernet/hisilicon/hisi_femac.c
> index 2c28088..96c32ae 100644
> --- a/drivers/net/ethernet/hisilicon/hisi_femac.c
> +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
> @@ -870,7 +870,7 @@ static int hisi_femac_drv_probe(struct
> platform_device *pdev)
>                            phy_modes(phy->interface));
> 
>         mac_addr = of_get_mac_address(node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> index e5d853b..b1cb58f 100644
> --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> @@ -1229,7 +1229,7 @@ static int hix5hd2_dev_probe(struct
> platform_device *pdev)
>         }
> 
>         mac_addr = of_get_mac_address(node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/lantiq_xrx200.c
> b/drivers/net/ethernet/lantiq_xrx200.c
> index d29104d..cda641e 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -478,7 +478,7 @@ static int xrx200_probe(struct platform_device
> *pdev)
>         }
> 
>         mac = of_get_mac_address(np);
> -       if (mac && is_valid_ether_addr(mac))
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(net_dev->dev_addr, mac);
>         else
>                 eth_hw_addr_random(net_dev); diff --git
> a/drivers/net/ethernet/marvell/mv643xx_eth.c
> b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 292a668..07e254f 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2749,7 +2749,7 @@ static int mv643xx_eth_shared_of_add_port(struct
> platform_device *pdev,
>         }
> 
>         mac_addr = of_get_mac_address(pnp);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
> 
>         mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
> diff --git a/drivers/net/ethernet/marvell/mvneta.c
> b/drivers/net/ethernet/marvell/mvneta.c
> index a715277..8186135 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -4563,7 +4563,7 @@ static int mvneta_probe(struct platform_device
> *pdev)
>         }
> 
>         dt_mac_addr = of_get_mac_address(dn);
> -       if (dt_mac_addr) {
> +       if (!IS_ERR(dt_mac_addr)) {
>                 mac_from = "device tree";
>                 memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
>         } else {
> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c
> b/drivers/net/ethernet/marvell/pxa168_eth.c
> index 35f2142..ce037e8 100644
> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> @@ -1461,7 +1461,7 @@ static int pxa168_eth_probe(struct
> platform_device *pdev)
>         if (pdev->dev.of_node)
>                 mac_addr = of_get_mac_address(pdev->dev.of_node);
> 
> -       if (mac_addr && is_valid_ether_addr(mac_addr)) {
> +       if (!IS_ERR_OR_NULL(mac_addr)) {
>                 ether_addr_copy(dev->dev_addr, mac_addr);
>         } else {
>                 /* try reading the mac address, if set by the bootloader */
> diff --git a/drivers/net/ethernet/marvell/sky2.c
> b/drivers/net/ethernet/marvell/sky2.c
> index 8b3495e..c4050ec 100644
> --- a/drivers/net/ethernet/marvell/sky2.c
> +++ b/drivers/net/ethernet/marvell/sky2.c
> @@ -4808,7 +4808,7 @@ static struct net_device *sky2_init_netdev(struct
> sky2_hw *hw, unsigned port,
>          * 2) from internal registers set by bootloader
>          */
>         iap = of_get_mac_address(hw->pdev->dev.of_node);
> -       if (iap)
> +       if (!IS_ERR(iap))
>                 memcpy(dev->dev_addr, iap, ETH_ALEN);
>         else
>                 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 +
> port * 8, diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 53abe92..f9fbb3f 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2028,7 +2028,7 @@ static int __init mtk_init(struct net_device *dev)
>         const char *mac_addr;
> 
>         mac_addr = of_get_mac_address(mac->of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(dev->dev_addr, mac_addr);
> 
>         /* If the mac address is invalid, use random mac address  */ diff
> --git a/drivers/net/ethernet/micrel/ks8851.c
> b/drivers/net/ethernet/micrel/ks8851.c
> index 7849119..b44172a 100644
> --- a/drivers/net/ethernet/micrel/ks8851.c
> +++ b/drivers/net/ethernet/micrel/ks8851.c
> @@ -425,7 +425,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
>         const u8 *mac_addr;
> 
>         mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
> -       if (mac_addr) {
> +       if (!IS_ERR(mac_addr)) {
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
>                 ks8851_write_mac_addr(dev);
>                 return;
> diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c
> b/drivers/net/ethernet/micrel/ks8851_mll.c
> index c946841..dc76b0d 100644
> --- a/drivers/net/ethernet/micrel/ks8851_mll.c
> +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
> @@ -1327,7 +1327,7 @@ static int ks8851_probe(struct platform_device
> *pdev)
>         /* overwriting the default MAC address */
>         if (pdev->dev.of_node) {
>                 mac = of_get_mac_address(pdev->dev.of_node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         memcpy(ks->mac_addr, mac, ETH_ALEN);
>         } else {
>                 struct ks8851_mll_platform_data *pdata; diff --git
> a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index 89d1739..da138ed 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1368,7 +1368,7 @@ static int lpc_eth_drv_probe(struct
> platform_device *pdev)
> 
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 const char *macaddr = of_get_mac_address(np);
> -               if (macaddr)
> +               if (!IS_ERR(macaddr))
>                         memcpy(ndev->dev_addr, macaddr,
> ETH_ALEN);
>         }
>         if (!is_valid_ether_addr(ndev->dev_addr))
> diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c
> b/drivers/net/ethernet/qualcomm/qca_spi.c
> index 97f9295..b28360b 100644
> --- a/drivers/net/ethernet/qualcomm/qca_spi.c
> +++ b/drivers/net/ethernet/qualcomm/qca_spi.c
> @@ -966,7 +966,7 @@
> 
>         mac = of_get_mac_address(spi->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(qca->net_dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(qca->net_dev->dev_addr)) { diff --git
> a/drivers/net/ethernet/qualcomm/qca_uart.c
> b/drivers/net/ethernet/qualcomm/qca_uart.c
> index db6068c..5906168 100644
> --- a/drivers/net/ethernet/qualcomm/qca_uart.c
> +++ b/drivers/net/ethernet/qualcomm/qca_uart.c
> @@ -351,7 +351,7 @@ static int qca_uart_probe(struct serdev_device
> *serdev)
> 
>         mac = of_get_mac_address(serdev->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(qca->net_dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(qca->net_dev->dev_addr)) { diff --git
> a/drivers/net/ethernet/renesas/ravb_main.c
> b/drivers/net/ethernet/renesas/ravb_main.c
> index 9618c48..d3ffcf5 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -111,7 +111,7 @@ static void ravb_set_buffer_align(struct sk_buff *skb)
>   */
>  static void ravb_read_mac_address(struct net_device *ndev, const u8 *mac)
> {
> -       if (mac) {
> +       if (!IS_ERR(mac)) {
>                 ether_addr_copy(ndev->dev_addr, mac);
>         } else {
>                 u32 mahr = ravb_read(ndev, MAHR); diff --git
> a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c
> index e33af37..4d4be66 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data
> *sh_eth_parse_dt(struct device *dev)
>         pdata->phy_interface = ret;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
> 
>         pdata->no_ether_link =
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> index fbd00cb..d2bc941 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> @@ -124,7 +124,7 @@ static int sxgbe_platform_probe(struct
> platform_device *pdev)
>         }
> 
>         /* Get MAC address if available (DT) */
> -       if (mac)
> +       if (!IS_ERR_OR_NULL(mac))
>                 ether_addr_copy(priv->dev->dev_addr, mac);
> 
>         /* Get the TX/RX IRQ numbers */
> diff --git a/drivers/net/ethernet/socionext/sni_ave.c
> b/drivers/net/ethernet/socionext/sni_ave.c
> index bb6d5fb..51a7b48 100644
> --- a/drivers/net/ethernet/socionext/sni_ave.c
> +++ b/drivers/net/ethernet/socionext/sni_ave.c
> @@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
>         ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN +
> ETH_FCS_LEN);
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
> 
>         /* if the mac address is invalid, use random mac address */ diff --git
> a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 5ab2733..5678b86 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4262,7 +4262,7 @@ int stmmac_dvr_probe(struct device *device,
>         priv->wol_irq = res->wol_irq;
>         priv->lpi_irq = res->lpi_irq;
> 
> -       if (res->mac)
> +       if (!IS_ERR_OR_NULL(res->mac))
>                 memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
> 
>         dev_set_drvdata(device, priv->dev); diff --git
> a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index
> e376806..b18eeb0 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -2232,7 +2232,7 @@ static int cpsw_probe_dt(struct
> cpsw_platform_data *data,
> 
>  no_phy_slave:
>                 mac_addr = of_get_mac_address(slave_node);
> -               if (mac_addr) {
> +               if (!IS_ERR(mac_addr)) {
>                         memcpy(slave_data->mac_addr, mac_addr,
> ETH_ALEN);
>                 } else {
>                         ret = ti_cm_get_macid(&pdev->dev, i, diff --git
> a/drivers/net/ethernet/ti/netcp_core.c
> b/drivers/net/ethernet/ti/netcp_core.c
> index 01d4ca3..6428439 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -2037,7 +2037,7 @@ static int netcp_create_interface(struct
> netcp_device *netcp_device,
>                 devm_release_mem_region(dev, res.start, size);
>         } else {
>                 mac_addr = of_get_mac_address(node_interface);
> -               if (mac_addr)
> +               if (!IS_ERR(mac_addr))
>                         ether_addr_copy(ndev->dev_addr, mac_addr);
>                 else
>                         eth_random_addr(ndev->dev_addr); diff --git
> a/drivers/net/ethernet/wiznet/w5100.c
> b/drivers/net/ethernet/wiznet/w5100.c
> index d8ba512..b0052933 100644
> --- a/drivers/net/ethernet/wiznet/w5100.c
> +++ b/drivers/net/ethernet/wiznet/w5100.c
> @@ -1164,7 +1164,7 @@ int w5100_probe(struct device *dev, const struct
> w5100_ops *ops,
>         INIT_WORK(&priv->setrx_work, w5100_setrx_work);
>         INIT_WORK(&priv->restart_work, w5100_restart_work);
> 
> -       if (mac_addr)
> +       if (!IS_ERR_OR_NULL(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/xilinx/ll_temac_main.c
> b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index 9851991..f389a81 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1252,7 +1252,7 @@ static int temac_probe(struct platform_device
> *pdev)
>         if (temac_np) {
>                 /* Retrieve the MAC address */
>                 addr = of_get_mac_address(temac_np);
> -               if (!addr) {
> +               if (IS_ERR(addr)) {
>                         dev_err(&pdev->dev, "could not find MAC
> address\n");
>                         return -ENODEV;
>                 }
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 4041c75..108fbc7 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1596,7 +1596,7 @@ static int axienet_probe(struct platform_device
> *pdev)
> 
>         /* Retrieve the MAC address */
>         mac_addr = of_get_mac_address(pdev->dev.of_node);
> -       if (!mac_addr) {
> +       if (IS_ERR(mac_addr)) {
>                 dev_err(&pdev->dev, "could not find MAC address\n");
>                 goto free_netdev;
>         }
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index fc38692..6911707 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1165,7 +1165,7 @@ static int xemaclite_of_probe(struct
> platform_device *ofdev)
>         lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
>         mac_address = of_get_mac_address(ofdev->dev.of_node);
> 
> -       if (mac_address) {
> +       if (!IS_ERR(mac_address)) {
>                 /* Set the MAC address. */
>                 memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
>         } else {
> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index fddcee3..4b2b222
> 100644
> --- a/net/ethernet/eth.c
> +++ b/net/ethernet/eth.c
> @@ -560,7 +560,7 @@ int eth_platform_get_mac_address(struct device
> *dev, u8 *mac_addr)
>         addr = NULL;
>         if (dp)
>                 addr = of_get_mac_address(dp);
> -       if (!addr)
> +       if (IS_ERR_OR_NULL(addr))
>                 addr = arch_get_platform_mac_address();
> 
>         if (!addr)
> --
> 1.9.1

_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

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

* RE: [EXT] [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error
@ 2019-05-08  3:07       ` Andy Duan
  0 siblings, 0 replies; 29+ messages in thread
From: Andy Duan @ 2019-05-08  3:07 UTC (permalink / raw)
  To: Petr Štetiar, netdev, David S. Miller, Andreas Larsson,
	Maxime Ripard, Chen-Yu Tsai, Thor Thayer, Florian Fainelli,
	Doug Berger, Sunil Goutham, Robert Richter,
	Madalin-cristian Bucur, Pantelis Antoniou, Claudiu Manoil,
	Leo Li, Yisen Zhuang, Salil Mehta, Hauke Mehrtens,
	Sebastian Hesselbarth, Thomas Petazzoni, Mirko Lindner,
	Stephen Hemminger, Felix Fietkau, John Crispin, Sean Wang,
	Nelson Chang, Matthias Brugger, Vladimir Zapolskiy,
	Sylvain Lemieux, Sergei Shtylyov, Byungho An, Girish K S,
	Vipul Pandya, Kunihiko Hayashi, Giuseppe Cavallaro,
	Alexandre Torgue, Jose Abreu, Maxime Coquelin, Grygorii Strashko,
	Wingman Kwok, Murali Karicheri, Michal Simek, Anirudha Sarangi,
	John Linn
  Cc: devel, Andrew Lunn, Greg Kroah-Hartman, linuxppc-dev,
	linux-mediatek, linux-kernel, linux-renesas-soc,
	bcm-kernel-feedback-list, nios2-dev, linux-omap, Frank Rowand,
	linux-stm32, linux-arm-kernel, Heiner Kallweit

From: Petr Štetiar <ynezz@true.cz> Sent: Tuesday, May 7, 2019 5:25 AM
> There was NVMEM support added to of_get_mac_address, so it could now
> return ERR_PTR encoded error values, so we need to adjust all current users
> of of_get_mac_address to this new fact.
> 
> While at it, remove superfluous is_valid_ether_addr as the MAC address
> returned from of_get_mac_address is always valid and checked by
> is_valid_ether_addr anyway.
> 
> Fixes: d01f449c008a ("of_net: add NVMEM support to of_get_mac_address")
> Signed-off-by: Petr Štetiar <ynezz@true.cz>

Test the patch on i.MX8MQ platform that fix the mem abort issue that is introduced in next-190507.

Tested-by: Fugang Duan <fugang.duan@nxp.com>
> ---
> 
>  This is defacto v5 of the previous 05/10 patch in the series, but since the
>  v4 of this 05/10 patch wasn't picked up by the patchwork for some unknown
> reason, this patch wasn't applied with the other 9 patches in the series, so
> I'm resending it as a separate patch of this fixup series.
> 
>  Changes since v1:
> 
>   * added Fixes: tag
> 
>  Previous changelog (Patch 05/10):
> 
>   Changes since v3:
> 
>    * IS_ERR_OR_NULL -> IS_ERR
> 
>   Changes since v4:
> 
>    * I've just blindly replaced IS_ERR_OR_NULL with IS_ERR, but I've just
>      realized, that in some cases we still need to check for NULL, so I've
>      corrected it in following drivers/files:
> 
>       - broadcom/bgmac-bcma.c
>       - marvell/pxa168_eth.c
>       - samsung/sxgbe/sxgbe_platform.c
>       - stmicro/stmmac/stmmac_main.c
>       - wiznet/w5100.c
>       - ethernet/eth.c
> 
>  drivers/net/ethernet/aeroflex/greth.c                 | 2 +-
>  drivers/net/ethernet/allwinner/sun4i-emac.c           | 2 +-
>  drivers/net/ethernet/altera/altera_tse_main.c         | 2 +-
>  drivers/net/ethernet/arc/emac_main.c                  | 2 +-
>  drivers/net/ethernet/aurora/nb8800.c                  | 2 +-
>  drivers/net/ethernet/broadcom/bcmsysport.c            | 2 +-
>  drivers/net/ethernet/broadcom/bgmac-bcma.c            | 2 +-
>  drivers/net/ethernet/broadcom/bgmac-platform.c        | 2 +-
>  drivers/net/ethernet/broadcom/genet/bcmgenet.c        | 2 +-
>  drivers/net/ethernet/cavium/octeon/octeon_mgmt.c      | 2 +-
>  drivers/net/ethernet/cavium/thunder/thunder_bgx.c     | 2 +-
>  drivers/net/ethernet/davicom/dm9000.c                 | 2 +-
>  drivers/net/ethernet/ethoc.c                          | 2 +-
>  drivers/net/ethernet/ezchip/nps_enet.c                | 2 +-
>  drivers/net/ethernet/freescale/fec_main.c             | 2 +-
>  drivers/net/ethernet/freescale/fec_mpc52xx.c          | 2 +-
>  drivers/net/ethernet/freescale/fman/mac.c             | 2 +-
>  drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c | 2 +-
>  drivers/net/ethernet/freescale/gianfar.c              | 2 +-
>  drivers/net/ethernet/freescale/ucc_geth.c             | 2 +-
>  drivers/net/ethernet/hisilicon/hisi_femac.c           | 2 +-
>  drivers/net/ethernet/hisilicon/hix5hd2_gmac.c         | 2 +-
>  drivers/net/ethernet/lantiq_xrx200.c                  | 2 +-
>  drivers/net/ethernet/marvell/mv643xx_eth.c            | 2 +-
>  drivers/net/ethernet/marvell/mvneta.c                 | 2 +-
>  drivers/net/ethernet/marvell/pxa168_eth.c             | 2 +-
>  drivers/net/ethernet/marvell/sky2.c                   | 2 +-
>  drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 2 +-
>  drivers/net/ethernet/micrel/ks8851.c                  | 2 +-
>  drivers/net/ethernet/micrel/ks8851_mll.c              | 2 +-
>  drivers/net/ethernet/nxp/lpc_eth.c                    | 2 +-
>  drivers/net/ethernet/qualcomm/qca_spi.c               | 2 +-
>  drivers/net/ethernet/qualcomm/qca_uart.c              | 2 +-
>  drivers/net/ethernet/renesas/ravb_main.c              | 2 +-
>  drivers/net/ethernet/renesas/sh_eth.c                 | 2 +-
>  drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c   | 2 +-
>  drivers/net/ethernet/socionext/sni_ave.c              | 2 +-
>  drivers/net/ethernet/stmicro/stmmac/stmmac_main.c     | 2 +-
>  drivers/net/ethernet/ti/cpsw.c                        | 2 +-
>  drivers/net/ethernet/ti/netcp_core.c                  | 2 +-
>  drivers/net/ethernet/wiznet/w5100.c                   | 2 +-
>  drivers/net/ethernet/xilinx/ll_temac_main.c           | 2 +-
>  drivers/net/ethernet/xilinx/xilinx_axienet_main.c     | 2 +-
>  drivers/net/ethernet/xilinx/xilinx_emaclite.c         | 2 +-
>  net/ethernet/eth.c                                    | 2 +-
>  45 files changed, 45 insertions(+), 45 deletions(-)
> 
> diff --git a/drivers/net/ethernet/aeroflex/greth.c
> b/drivers/net/ethernet/aeroflex/greth.c
> index 47e5984..7c5cf02 100644
> --- a/drivers/net/ethernet/aeroflex/greth.c
> +++ b/drivers/net/ethernet/aeroflex/greth.c
> @@ -1459,7 +1459,7 @@ static int greth_of_probe(struct platform_device
> *ofdev)
>                 const u8 *addr;
> 
>                 addr = of_get_mac_address(ofdev->dev.of_node);
> -               if (addr) {
> +               if (!IS_ERR(addr)) {
>                         for (i = 0; i < 6; i++)
>                                 macaddr[i] = (unsigned int) addr[i];
>                 } else {
> diff --git a/drivers/net/ethernet/allwinner/sun4i-emac.c
> b/drivers/net/ethernet/allwinner/sun4i-emac.c
> index e1acafa..37ebd89 100644
> --- a/drivers/net/ethernet/allwinner/sun4i-emac.c
> +++ b/drivers/net/ethernet/allwinner/sun4i-emac.c
> @@ -870,7 +870,7 @@ static int emac_probe(struct platform_device *pdev)
> 
>         /* Read MAC-address from DT */
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
> 
>         /* Check if the MAC address is valid, if not get a random one */ diff
> --git a/drivers/net/ethernet/altera/altera_tse_main.c
> b/drivers/net/ethernet/altera/altera_tse_main.c
> index aa1d1f5..877e67f 100644
> --- a/drivers/net/ethernet/altera/altera_tse_main.c
> +++ b/drivers/net/ethernet/altera/altera_tse_main.c
> @@ -1537,7 +1537,7 @@ static int altera_tse_probe(struct platform_device
> *pdev)
> 
>         /* get default MAC address from device tree */
>         macaddr = of_get_mac_address(pdev->dev.of_node);
> -       if (macaddr)
> +       if (!IS_ERR(macaddr))
>                 ether_addr_copy(ndev->dev_addr, macaddr);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/arc/emac_main.c
> b/drivers/net/ethernet/arc/emac_main.c
> index ff3d685..7f89ad5 100644
> --- a/drivers/net/ethernet/arc/emac_main.c
> +++ b/drivers/net/ethernet/arc/emac_main.c
> @@ -960,7 +960,7 @@ int arc_emac_probe(struct net_device *ndev, int
> interface)
>         /* Get MAC address from device tree */
>         mac_addr = of_get_mac_address(dev->of_node);
> 
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/aurora/nb8800.c
> b/drivers/net/ethernet/aurora/nb8800.c
> index f62deeb..3c4967e 100644
> --- a/drivers/net/ethernet/aurora/nb8800.c
> +++ b/drivers/net/ethernet/aurora/nb8800.c
> @@ -1463,7 +1463,7 @@ static int nb8800_probe(struct platform_device
> *pdev)
>         dev->irq = irq;
> 
>         mac = of_get_mac_address(pdev->dev.of_node);
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(dev->dev_addr))
> diff --git a/drivers/net/ethernet/broadcom/bcmsysport.c
> b/drivers/net/ethernet/broadcom/bcmsysport.c
> index 4e87a30..c623896 100644
> --- a/drivers/net/ethernet/broadcom/bcmsysport.c
> +++ b/drivers/net/ethernet/broadcom/bcmsysport.c
> @@ -2505,7 +2505,7 @@ static int bcm_sysport_probe(struct
> platform_device *pdev)
> 
>         /* Initialize netdevice members */
>         macaddr = of_get_mac_address(dn);
> -       if (!macaddr || !is_valid_ether_addr(macaddr)) {
> +       if (IS_ERR(macaddr)) {
>                 dev_warn(&pdev->dev, "using random Ethernet MAC\n");
>                 eth_hw_addr_random(dev);
>         } else {
> diff --git a/drivers/net/ethernet/broadcom/bgmac-bcma.c
> b/drivers/net/ethernet/broadcom/bgmac-bcma.c
> index 6fe074c..34d1830 100644
> --- a/drivers/net/ethernet/broadcom/bgmac-bcma.c
> +++ b/drivers/net/ethernet/broadcom/bgmac-bcma.c
> @@ -132,7 +132,7 @@ static int bgmac_probe(struct bcma_device *core)
>                 mac = of_get_mac_address(bgmac->dev->of_node);
> 
>         /* If no MAC address assigned via device tree, check SPROM */
> -       if (!mac) {
> +       if (IS_ERR_OR_NULL(mac)) {
>                 switch (core->core_unit) {
>                 case 0:
>                         mac = sprom->et0mac; diff --git
> a/drivers/net/ethernet/broadcom/bgmac-platform.c
> b/drivers/net/ethernet/broadcom/bgmac-platform.c
> index 894eda5..6dc0dd9 100644
> --- a/drivers/net/ethernet/broadcom/bgmac-platform.c
> +++ b/drivers/net/ethernet/broadcom/bgmac-platform.c
> @@ -193,7 +193,7 @@ static int bgmac_probe(struct platform_device *pdev)
>         bgmac->dma_dev = &pdev->dev;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(bgmac->net_dev->dev_addr,
> mac_addr);
>         else
>                 dev_warn(&pdev->dev, "MAC address not present in
> device tree\n"); diff --git
> a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> index 4fd9735..374b9ff 100644
> --- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> +++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
> @@ -3476,7 +3476,7 @@ static int bcmgenet_probe(struct platform_device
> *pdev)
> 
>         if (dn) {
>                 macaddr = of_get_mac_address(dn);
> -               if (!macaddr) {
> +               if (IS_ERR(macaddr)) {
>                         dev_err(&pdev->dev, "can't find MAC
> address\n");
>                         err = -EINVAL;
>                         goto err;
> diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> index 5359c10..15b1130 100644
> --- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> +++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
> @@ -1503,7 +1503,7 @@ static int octeon_mgmt_probe(struct
> platform_device *pdev)
> 
>         mac = of_get_mac_address(pdev->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 memcpy(netdev->dev_addr, mac, ETH_ALEN);
>         else
>                 eth_hw_addr_random(netdev); diff --git
> a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> index 81c281a..a65be85 100644
> --- a/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> +++ b/drivers/net/ethernet/cavium/thunder/thunder_bgx.c
> @@ -1484,7 +1484,7 @@ static int bgx_init_of_phy(struct bgx *bgx)
>                         break;
> 
>                 mac = of_get_mac_address(node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         ether_addr_copy(bgx->lmac[lmac].mac, mac);
> 
>                 SET_NETDEV_DEV(&bgx->lmac[lmac].netdev,
> &bgx->pdev->dev); diff --git a/drivers/net/ethernet/davicom/dm9000.c
> b/drivers/net/ethernet/davicom/dm9000.c
> index c2586f4..953ee56 100644
> --- a/drivers/net/ethernet/davicom/dm9000.c
> +++ b/drivers/net/ethernet/davicom/dm9000.c
> @@ -1412,7 +1412,7 @@ static struct dm9000_plat_data
> *dm9000_parse_dt(struct device *dev)
>                 pdata->flags |= DM9000_PLATF_NO_EEPROM;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(pdata->dev_addr, mac_addr,
> sizeof(pdata->dev_addr));
> 
>         return pdata;
> diff --git a/drivers/net/ethernet/ethoc.c b/drivers/net/ethernet/ethoc.c
> index 0f3e7f2..71da049 100644
> --- a/drivers/net/ethernet/ethoc.c
> +++ b/drivers/net/ethernet/ethoc.c
> @@ -1153,7 +1153,7 @@ static int ethoc_probe(struct platform_device
> *pdev)
>                 const void *mac;
> 
>                 mac = of_get_mac_address(pdev->dev.of_node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         ether_addr_copy(netdev->dev_addr, mac);
>                 priv->phy_id = -1;
>         }
> diff --git a/drivers/net/ethernet/ezchip/nps_enet.c
> b/drivers/net/ethernet/ezchip/nps_enet.c
> index 659f1ad..b4ce261 100644
> --- a/drivers/net/ethernet/ezchip/nps_enet.c
> +++ b/drivers/net/ethernet/ezchip/nps_enet.c
> @@ -616,7 +616,7 @@ static s32 nps_enet_probe(struct platform_device
> *pdev)
> 
>         /* set kernel MAC address to dev */
>         mac_addr = of_get_mac_address(dev->of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index a96ad20..aa7d4e2 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -1655,7 +1655,7 @@ static void fec_get_mac(struct net_device *ndev)
>                 struct device_node *np = fep->pdev->dev.of_node;
>                 if (np) {
>                         const char *mac = of_get_mac_address(np);
> -                       if (mac)
> +                       if (!IS_ERR(mac))
>                                 iap = (unsigned char *) mac;
>                 }
>         }
> diff --git a/drivers/net/ethernet/freescale/fec_mpc52xx.c
> b/drivers/net/ethernet/freescale/fec_mpc52xx.c
> index c1968b3..7b7e526 100644
> --- a/drivers/net/ethernet/freescale/fec_mpc52xx.c
> +++ b/drivers/net/ethernet/freescale/fec_mpc52xx.c
> @@ -902,7 +902,7 @@ static int mpc52xx_fec_probe(struct platform_device
> *op)
>          * First try to read MAC address from DT
>          */
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr) {
> +       if (!IS_ERR(mac_addr)) {
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         } else {
>                 struct mpc52xx_fec __iomem *fec = priv->fec; diff --git
> a/drivers/net/ethernet/freescale/fman/mac.c
> b/drivers/net/ethernet/freescale/fman/mac.c
> index 3c21486..9cd2c28 100644
> --- a/drivers/net/ethernet/freescale/fman/mac.c
> +++ b/drivers/net/ethernet/freescale/fman/mac.c
> @@ -724,7 +724,7 @@ static int mac_probe(struct platform_device
> *_of_dev)
> 
>         /* Get the MAC address */
>         mac_addr = of_get_mac_address(mac_node);
> -       if (!mac_addr) {
> +       if (IS_ERR(mac_addr)) {
>                 dev_err(dev, "of_get_mac_address(%pOF) failed\n",
> mac_node);
>                 err = -EINVAL;
>                 goto _return_of_get_parent; diff --git
> a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> index 7c548ed..90ea7a1 100644
> --- a/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> +++ b/drivers/net/ethernet/freescale/fs_enet/fs_enet-main.c
> @@ -1014,7 +1014,7 @@ static int fs_enet_probe(struct platform_device
> *ofdev)
>         spin_lock_init(&fep->tx_lock);
> 
>         mac_addr = of_get_mac_address(ofdev->dev.of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
> 
>         ret = fep->ops->allocate_bd(ndev); diff --git
> a/drivers/net/ethernet/freescale/gianfar.c
> b/drivers/net/ethernet/freescale/gianfar.c
> index 45fcc96..df13c69 100644
> --- a/drivers/net/ethernet/freescale/gianfar.c
> +++ b/drivers/net/ethernet/freescale/gianfar.c
> @@ -872,7 +872,7 @@ static int gfar_of_init(struct platform_device *ofdev,
> struct net_device **pdev)
> 
>         mac_addr = of_get_mac_address(np);
> 
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
> 
>         if (model && !strcasecmp(model, "TSEC")) diff --git
> a/drivers/net/ethernet/freescale/ucc_geth.c
> b/drivers/net/ethernet/freescale/ucc_geth.c
> index eb3e65e..216e99a 100644
> --- a/drivers/net/ethernet/freescale/ucc_geth.c
> +++ b/drivers/net/ethernet/freescale/ucc_geth.c
> @@ -3910,7 +3910,7 @@ static int ucc_geth_probe(struct platform_device*
> ofdev)
>         }
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
> 
>         ugeth->ug_info = ug_info;
> diff --git a/drivers/net/ethernet/hisilicon/hisi_femac.c
> b/drivers/net/ethernet/hisilicon/hisi_femac.c
> index 2c28088..96c32ae 100644
> --- a/drivers/net/ethernet/hisilicon/hisi_femac.c
> +++ b/drivers/net/ethernet/hisilicon/hisi_femac.c
> @@ -870,7 +870,7 @@ static int hisi_femac_drv_probe(struct
> platform_device *pdev)
>                            phy_modes(phy->interface));
> 
>         mac_addr = of_get_mac_address(node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> index e5d853b..b1cb58f 100644
> --- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> +++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
> @@ -1229,7 +1229,7 @@ static int hix5hd2_dev_probe(struct
> platform_device *pdev)
>         }
> 
>         mac_addr = of_get_mac_address(node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/lantiq_xrx200.c
> b/drivers/net/ethernet/lantiq_xrx200.c
> index d29104d..cda641e 100644
> --- a/drivers/net/ethernet/lantiq_xrx200.c
> +++ b/drivers/net/ethernet/lantiq_xrx200.c
> @@ -478,7 +478,7 @@ static int xrx200_probe(struct platform_device
> *pdev)
>         }
> 
>         mac = of_get_mac_address(np);
> -       if (mac && is_valid_ether_addr(mac))
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(net_dev->dev_addr, mac);
>         else
>                 eth_hw_addr_random(net_dev); diff --git
> a/drivers/net/ethernet/marvell/mv643xx_eth.c
> b/drivers/net/ethernet/marvell/mv643xx_eth.c
> index 292a668..07e254f 100644
> --- a/drivers/net/ethernet/marvell/mv643xx_eth.c
> +++ b/drivers/net/ethernet/marvell/mv643xx_eth.c
> @@ -2749,7 +2749,7 @@ static int mv643xx_eth_shared_of_add_port(struct
> platform_device *pdev,
>         }
> 
>         mac_addr = of_get_mac_address(pnp);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(ppd.mac_addr, mac_addr, ETH_ALEN);
> 
>         mv643xx_eth_property(pnp, "tx-queue-size", ppd.tx_queue_size);
> diff --git a/drivers/net/ethernet/marvell/mvneta.c
> b/drivers/net/ethernet/marvell/mvneta.c
> index a715277..8186135 100644
> --- a/drivers/net/ethernet/marvell/mvneta.c
> +++ b/drivers/net/ethernet/marvell/mvneta.c
> @@ -4563,7 +4563,7 @@ static int mvneta_probe(struct platform_device
> *pdev)
>         }
> 
>         dt_mac_addr = of_get_mac_address(dn);
> -       if (dt_mac_addr) {
> +       if (!IS_ERR(dt_mac_addr)) {
>                 mac_from = "device tree";
>                 memcpy(dev->dev_addr, dt_mac_addr, ETH_ALEN);
>         } else {
> diff --git a/drivers/net/ethernet/marvell/pxa168_eth.c
> b/drivers/net/ethernet/marvell/pxa168_eth.c
> index 35f2142..ce037e8 100644
> --- a/drivers/net/ethernet/marvell/pxa168_eth.c
> +++ b/drivers/net/ethernet/marvell/pxa168_eth.c
> @@ -1461,7 +1461,7 @@ static int pxa168_eth_probe(struct
> platform_device *pdev)
>         if (pdev->dev.of_node)
>                 mac_addr = of_get_mac_address(pdev->dev.of_node);
> 
> -       if (mac_addr && is_valid_ether_addr(mac_addr)) {
> +       if (!IS_ERR_OR_NULL(mac_addr)) {
>                 ether_addr_copy(dev->dev_addr, mac_addr);
>         } else {
>                 /* try reading the mac address, if set by the bootloader */
> diff --git a/drivers/net/ethernet/marvell/sky2.c
> b/drivers/net/ethernet/marvell/sky2.c
> index 8b3495e..c4050ec 100644
> --- a/drivers/net/ethernet/marvell/sky2.c
> +++ b/drivers/net/ethernet/marvell/sky2.c
> @@ -4808,7 +4808,7 @@ static struct net_device *sky2_init_netdev(struct
> sky2_hw *hw, unsigned port,
>          * 2) from internal registers set by bootloader
>          */
>         iap = of_get_mac_address(hw->pdev->dev.of_node);
> -       if (iap)
> +       if (!IS_ERR(iap))
>                 memcpy(dev->dev_addr, iap, ETH_ALEN);
>         else
>                 memcpy_fromio(dev->dev_addr, hw->regs + B2_MAC_1 +
> port * 8, diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 53abe92..f9fbb3f 100644
> --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -2028,7 +2028,7 @@ static int __init mtk_init(struct net_device *dev)
>         const char *mac_addr;
> 
>         mac_addr = of_get_mac_address(mac->of_node);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(dev->dev_addr, mac_addr);
> 
>         /* If the mac address is invalid, use random mac address  */ diff
> --git a/drivers/net/ethernet/micrel/ks8851.c
> b/drivers/net/ethernet/micrel/ks8851.c
> index 7849119..b44172a 100644
> --- a/drivers/net/ethernet/micrel/ks8851.c
> +++ b/drivers/net/ethernet/micrel/ks8851.c
> @@ -425,7 +425,7 @@ static void ks8851_init_mac(struct ks8851_net *ks)
>         const u8 *mac_addr;
> 
>         mac_addr = of_get_mac_address(ks->spidev->dev.of_node);
> -       if (mac_addr) {
> +       if (!IS_ERR(mac_addr)) {
>                 memcpy(dev->dev_addr, mac_addr, ETH_ALEN);
>                 ks8851_write_mac_addr(dev);
>                 return;
> diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c
> b/drivers/net/ethernet/micrel/ks8851_mll.c
> index c946841..dc76b0d 100644
> --- a/drivers/net/ethernet/micrel/ks8851_mll.c
> +++ b/drivers/net/ethernet/micrel/ks8851_mll.c
> @@ -1327,7 +1327,7 @@ static int ks8851_probe(struct platform_device
> *pdev)
>         /* overwriting the default MAC address */
>         if (pdev->dev.of_node) {
>                 mac = of_get_mac_address(pdev->dev.of_node);
> -               if (mac)
> +               if (!IS_ERR(mac))
>                         memcpy(ks->mac_addr, mac, ETH_ALEN);
>         } else {
>                 struct ks8851_mll_platform_data *pdata; diff --git
> a/drivers/net/ethernet/nxp/lpc_eth.c b/drivers/net/ethernet/nxp/lpc_eth.c
> index 89d1739..da138ed 100644
> --- a/drivers/net/ethernet/nxp/lpc_eth.c
> +++ b/drivers/net/ethernet/nxp/lpc_eth.c
> @@ -1368,7 +1368,7 @@ static int lpc_eth_drv_probe(struct
> platform_device *pdev)
> 
>         if (!is_valid_ether_addr(ndev->dev_addr)) {
>                 const char *macaddr = of_get_mac_address(np);
> -               if (macaddr)
> +               if (!IS_ERR(macaddr))
>                         memcpy(ndev->dev_addr, macaddr,
> ETH_ALEN);
>         }
>         if (!is_valid_ether_addr(ndev->dev_addr))
> diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c
> b/drivers/net/ethernet/qualcomm/qca_spi.c
> index 97f9295..b28360b 100644
> --- a/drivers/net/ethernet/qualcomm/qca_spi.c
> +++ b/drivers/net/ethernet/qualcomm/qca_spi.c
> @@ -966,7 +966,7 @@
> 
>         mac = of_get_mac_address(spi->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(qca->net_dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(qca->net_dev->dev_addr)) { diff --git
> a/drivers/net/ethernet/qualcomm/qca_uart.c
> b/drivers/net/ethernet/qualcomm/qca_uart.c
> index db6068c..5906168 100644
> --- a/drivers/net/ethernet/qualcomm/qca_uart.c
> +++ b/drivers/net/ethernet/qualcomm/qca_uart.c
> @@ -351,7 +351,7 @@ static int qca_uart_probe(struct serdev_device
> *serdev)
> 
>         mac = of_get_mac_address(serdev->dev.of_node);
> 
> -       if (mac)
> +       if (!IS_ERR(mac))
>                 ether_addr_copy(qca->net_dev->dev_addr, mac);
> 
>         if (!is_valid_ether_addr(qca->net_dev->dev_addr)) { diff --git
> a/drivers/net/ethernet/renesas/ravb_main.c
> b/drivers/net/ethernet/renesas/ravb_main.c
> index 9618c48..d3ffcf5 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
> @@ -111,7 +111,7 @@ static void ravb_set_buffer_align(struct sk_buff *skb)
>   */
>  static void ravb_read_mac_address(struct net_device *ndev, const u8 *mac)
> {
> -       if (mac) {
> +       if (!IS_ERR(mac)) {
>                 ether_addr_copy(ndev->dev_addr, mac);
>         } else {
>                 u32 mahr = ravb_read(ndev, MAHR); diff --git
> a/drivers/net/ethernet/renesas/sh_eth.c
> b/drivers/net/ethernet/renesas/sh_eth.c
> index e33af37..4d4be66 100644
> --- a/drivers/net/ethernet/renesas/sh_eth.c
> +++ b/drivers/net/ethernet/renesas/sh_eth.c
> @@ -3193,7 +3193,7 @@ static struct sh_eth_plat_data
> *sh_eth_parse_dt(struct device *dev)
>         pdata->phy_interface = ret;
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 memcpy(pdata->mac_addr, mac_addr, ETH_ALEN);
> 
>         pdata->no_ether_link =
> diff --git a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> index fbd00cb..d2bc941 100644
> --- a/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> +++ b/drivers/net/ethernet/samsung/sxgbe/sxgbe_platform.c
> @@ -124,7 +124,7 @@ static int sxgbe_platform_probe(struct
> platform_device *pdev)
>         }
> 
>         /* Get MAC address if available (DT) */
> -       if (mac)
> +       if (!IS_ERR_OR_NULL(mac))
>                 ether_addr_copy(priv->dev->dev_addr, mac);
> 
>         /* Get the TX/RX IRQ numbers */
> diff --git a/drivers/net/ethernet/socionext/sni_ave.c
> b/drivers/net/ethernet/socionext/sni_ave.c
> index bb6d5fb..51a7b48 100644
> --- a/drivers/net/ethernet/socionext/sni_ave.c
> +++ b/drivers/net/ethernet/socionext/sni_ave.c
> @@ -1599,7 +1599,7 @@ static int ave_probe(struct platform_device *pdev)
>         ndev->max_mtu = AVE_MAX_ETHFRAME - (ETH_HLEN +
> ETH_FCS_LEN);
> 
>         mac_addr = of_get_mac_address(np);
> -       if (mac_addr)
> +       if (!IS_ERR(mac_addr))
>                 ether_addr_copy(ndev->dev_addr, mac_addr);
> 
>         /* if the mac address is invalid, use random mac address */ diff --git
> a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> index 5ab2733..5678b86 100644
> --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
> @@ -4262,7 +4262,7 @@ int stmmac_dvr_probe(struct device *device,
>         priv->wol_irq = res->wol_irq;
>         priv->lpi_irq = res->lpi_irq;
> 
> -       if (res->mac)
> +       if (!IS_ERR_OR_NULL(res->mac))
>                 memcpy(priv->dev->dev_addr, res->mac, ETH_ALEN);
> 
>         dev_set_drvdata(device, priv->dev); diff --git
> a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c index
> e376806..b18eeb0 100644
> --- a/drivers/net/ethernet/ti/cpsw.c
> +++ b/drivers/net/ethernet/ti/cpsw.c
> @@ -2232,7 +2232,7 @@ static int cpsw_probe_dt(struct
> cpsw_platform_data *data,
> 
>  no_phy_slave:
>                 mac_addr = of_get_mac_address(slave_node);
> -               if (mac_addr) {
> +               if (!IS_ERR(mac_addr)) {
>                         memcpy(slave_data->mac_addr, mac_addr,
> ETH_ALEN);
>                 } else {
>                         ret = ti_cm_get_macid(&pdev->dev, i, diff --git
> a/drivers/net/ethernet/ti/netcp_core.c
> b/drivers/net/ethernet/ti/netcp_core.c
> index 01d4ca3..6428439 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -2037,7 +2037,7 @@ static int netcp_create_interface(struct
> netcp_device *netcp_device,
>                 devm_release_mem_region(dev, res.start, size);
>         } else {
>                 mac_addr = of_get_mac_address(node_interface);
> -               if (mac_addr)
> +               if (!IS_ERR(mac_addr))
>                         ether_addr_copy(ndev->dev_addr, mac_addr);
>                 else
>                         eth_random_addr(ndev->dev_addr); diff --git
> a/drivers/net/ethernet/wiznet/w5100.c
> b/drivers/net/ethernet/wiznet/w5100.c
> index d8ba512..b0052933 100644
> --- a/drivers/net/ethernet/wiznet/w5100.c
> +++ b/drivers/net/ethernet/wiznet/w5100.c
> @@ -1164,7 +1164,7 @@ int w5100_probe(struct device *dev, const struct
> w5100_ops *ops,
>         INIT_WORK(&priv->setrx_work, w5100_setrx_work);
>         INIT_WORK(&priv->restart_work, w5100_restart_work);
> 
> -       if (mac_addr)
> +       if (!IS_ERR_OR_NULL(mac_addr))
>                 memcpy(ndev->dev_addr, mac_addr, ETH_ALEN);
>         else
>                 eth_hw_addr_random(ndev); diff --git
> a/drivers/net/ethernet/xilinx/ll_temac_main.c
> b/drivers/net/ethernet/xilinx/ll_temac_main.c
> index 9851991..f389a81 100644
> --- a/drivers/net/ethernet/xilinx/ll_temac_main.c
> +++ b/drivers/net/ethernet/xilinx/ll_temac_main.c
> @@ -1252,7 +1252,7 @@ static int temac_probe(struct platform_device
> *pdev)
>         if (temac_np) {
>                 /* Retrieve the MAC address */
>                 addr = of_get_mac_address(temac_np);
> -               if (!addr) {
> +               if (IS_ERR(addr)) {
>                         dev_err(&pdev->dev, "could not find MAC
> address\n");
>                         return -ENODEV;
>                 }
> diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> index 4041c75..108fbc7 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
> @@ -1596,7 +1596,7 @@ static int axienet_probe(struct platform_device
> *pdev)
> 
>         /* Retrieve the MAC address */
>         mac_addr = of_get_mac_address(pdev->dev.of_node);
> -       if (!mac_addr) {
> +       if (IS_ERR(mac_addr)) {
>                 dev_err(&pdev->dev, "could not find MAC address\n");
>                 goto free_netdev;
>         }
> diff --git a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> index fc38692..6911707 100644
> --- a/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> +++ b/drivers/net/ethernet/xilinx/xilinx_emaclite.c
> @@ -1165,7 +1165,7 @@ static int xemaclite_of_probe(struct
> platform_device *ofdev)
>         lp->rx_ping_pong = get_bool(ofdev, "xlnx,rx-ping-pong");
>         mac_address = of_get_mac_address(ofdev->dev.of_node);
> 
> -       if (mac_address) {
> +       if (!IS_ERR(mac_address)) {
>                 /* Set the MAC address. */
>                 memcpy(ndev->dev_addr, mac_address, ETH_ALEN);
>         } else {
> diff --git a/net/ethernet/eth.c b/net/ethernet/eth.c index fddcee3..4b2b222
> 100644
> --- a/net/ethernet/eth.c
> +++ b/net/ethernet/eth.c
> @@ -560,7 +560,7 @@ int eth_platform_get_mac_address(struct device
> *dev, u8 *mac_addr)
>         addr = NULL;
>         if (dp)
>                 addr = of_get_mac_address(dp);
> -       if (!addr)
> +       if (IS_ERR_OR_NULL(addr))
>                 addr = arch_get_platform_mac_address();
> 
>         if (!addr)
> --
> 1.9.1


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

end of thread, other threads:[~2019-05-08  3:52 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-06 21:24 [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes Petr Štetiar
2019-05-06 21:24 ` Petr Štetiar
2019-05-06 21:24 ` [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error Petr Štetiar
2019-05-06 21:24   ` Petr Štetiar
     [not found]   ` <1557177887-30446-2-git-send-email-ynezz-knWk7/PSn+s@public.gmane.org>
2019-05-08  3:07     ` [EXT] " Andy Duan
2019-05-08  3:07       ` Andy Duan
2019-05-06 21:24 ` [PATCH net-next v2 2/4] net: dsa: " Petr Štetiar
2019-05-07 13:49   ` Vladimir Oltean
2019-05-06 21:24 ` [PATCH net-next v2 3/4] staging: octeon-ethernet: Fix of_get_mac_address ERR_PTR check Petr Štetiar
2019-05-06 21:24 ` [PATCH net-next v2 4/4] net: usb: smsc: fix warning reported by kbuild test robot Petr Štetiar
2019-05-06 21:29   ` Woojung.Huh
2019-05-06 21:27 ` [PATCH net-next v2 1/4] net: ethernet: support of_get_mac_address new ERR_PTR error Petr Štetiar
2019-05-07  7:19 ` [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes Dan Carpenter
2019-05-07  7:19   ` Dan Carpenter
2019-05-07  7:19   ` Dan Carpenter
2019-05-07  7:41   ` Greg Kroah-Hartman
2019-05-07  7:41     ` Greg Kroah-Hartman
2019-05-07  8:39   ` Petr Štetiar
2019-05-07  8:39     ` Petr Štetiar
2019-05-07  9:01     ` netdev patchwork issues [Was: Re: [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes] Petr Štetiar
2019-05-07  9:01       ` Petr Štetiar
2019-05-07  9:44     ` [PATCH net-next v2 0/4] of_get_mac_address ERR_PTR fixes Dan Carpenter
2019-05-07  9:44       ` Dan Carpenter
2019-05-07  9:07 ` Geert Uytterhoeven
2019-05-07  9:07   ` Geert Uytterhoeven
2019-05-07 12:14 ` Leonard Crestez
2019-05-07 12:14   ` Leonard Crestez
2019-05-07 19:23 ` David Miller
2019-05-07 19:23   ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.