From: Liyin Zhang <[email protected]> This fixes the following compilation warnings: drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c: In function ‘init_mac’: drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c:901:44: warning: passing argument 2 of ‘qse_update_mac_addr’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 901 | qse_update_mac_addr(priv, priv->dev->dev_addr); | ~~~~~~~~~^~~~~~~~~~ drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c:675:74: note: expected ‘u8 *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’ 675 | static void qse_update_mac_addr(struct intel_fpga_qse_private *priv, u8 *addr) | ~~~~^~~~ drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c: In function ‘intel_fpga_qse_ll_probe’: drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c:1577:57: warning: passing argument 2 of ‘of_get_mac_address’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1577 | ret = of_get_mac_address(pdev->dev.of_node, ndev->dev_addr); | ~~~~^~~~~~~~~~ In file included from drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c:29: ./include/linux/of_net.h:16:59: note: expected ‘u8 *’ {aka ‘unsigned char *’} but argument is of type ‘const unsigned char *’ 16 | extern int of_get_mac_address(struct device_node *np, u8 *mac); | ~~~~^~~
Signed-off-by: Liyin Zhang <[email protected]> --- drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c index f08edfde18fc..334ca8f05a70 100644 --- a/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c +++ b/drivers/net/ethernet/altera/intel_fpga_qse_ll_main.c @@ -672,7 +672,7 @@ static int qse_change_mtu(struct net_device *dev, int new_mtu) return 0; } -static void qse_update_mac_addr(struct intel_fpga_qse_private *priv, u8 *addr) +static void qse_update_mac_addr(struct intel_fpga_qse_private *priv, const u8 *addr) { u32 msb; u32 lsb; @@ -1387,6 +1387,7 @@ static int intel_fpga_qse_ll_probe(struct platform_device *pdev) struct intel_fpga_qse_private *priv; struct device_node *np = pdev->dev.of_node; const struct of_device_id *of_id = NULL; + u8 addr[ETH_ALEN]; ndev = alloc_etherdev(sizeof(struct intel_fpga_qse_private)); if (!ndev) { @@ -1573,8 +1574,10 @@ static int intel_fpga_qse_ll_probe(struct platform_device *pdev) } /* get default MAC address from device tree */ - ret = of_get_mac_address(pdev->dev.of_node, ndev->dev_addr); - if (ret) + ret = of_get_mac_address(pdev->dev.of_node, addr); + if (!ret) + eth_hw_addr_set(ndev, addr); + else eth_hw_addr_random(ndev); /* initialize netdev */ -- 2.34.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#16004): https://lists.yoctoproject.org/g/linux-yocto/message/16004 Mute This Topic: https://lists.yoctoproject.org/mt/116480401/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
