[openwrt/openwrt] lantiq: fix compilation warning in lantiq_etop_init

LEDE Commits lede-commits at lists.infradead.org
Thu May 11 18:24:48 PDT 2023


ansuel pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/0e2a3322529dae1fe5d3706c317c4217b7403619

commit 0e2a3322529dae1fe5d3706c317c4217b7403619
Author: Aleksander Jan Bajkowski <olek2 at wp.pl>
AuthorDate: Sat May 6 15:59:24 2023 +0200

    lantiq: fix compilation warning in lantiq_etop_init
    
    Commit c5cc3d96109a ("lantiq: Change the data-type of mac address in ETOP driver")
    changed the type of the mac variable. Since then, the priv->mac check always evaluates
    as true, so this check can be removed.
    
    This fix compilation warning:
    drivers/net/ethernet/lantiq_etop.c: In function 'ltq_etop_init':
    drivers/net/ethernet/lantiq_etop.c:775:13: warning: the comparison will always evaluate as 'true' for the address of 'mac' will never be NULL [-Waddress]
      775 |         if (priv->mac && !is_valid_ether_addr(mac.sa_data))
          |             ^~~~
    drivers/net/ethernet/lantiq_etop.c:157:23: note: 'mac' declared here
      157 |         unsigned char mac[6];
          |
    cc1: all warnings being treated as errors
    
    Fixes: c5cc3d96109a ("lantiq: Change the data-type of mac address in ETOP driver")
    Signed-off-by: Aleksander Jan Bajkowski <olek2 at wp.pl>
    [ fix wrong fixes tag format ]
    Signed-off-by: Christian Marangi <ansuelsmth at gmail.com>
---
 .../0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch            | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/target/linux/lantiq/patches-5.15/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch b/target/linux/lantiq/patches-5.15/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
index c80045e878..f7fbfdf9e4 100644
--- a/target/linux/lantiq/patches-5.15/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
+++ b/target/linux/lantiq/patches-5.15/0035-owrt-lantiq-wifi-and-ethernet-eeprom-handling.patch
@@ -210,7 +210,7 @@ Signed-off-by: John Crispin <blogic at openwrt.org>
 -	memcpy(&mac, &priv->pldata->mac, sizeof(struct sockaddr));
 +	memcpy(&mac.sa_data, ltq_get_eth_mac(), ETH_ALEN);
 +
-+	if (priv->mac && !is_valid_ether_addr(mac.sa_data))
++	if (!is_valid_ether_addr(mac.sa_data))
 +		memcpy(&mac.sa_data, priv->mac, ETH_ALEN);
 +
  	if (!is_valid_ether_addr(mac.sa_data)) {




More information about the lede-commits mailing list