]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: wilc1000: set wilc_set_mac_address parameter as const
authorAlexis Lothoré <alexis.lothore@bootlin.com>
Tue, 14 May 2024 15:51:21 +0000 (17:51 +0200)
committerKalle Valo <kvalo@kernel.org>
Fri, 17 May 2024 08:01:51 +0000 (11:01 +0300)
Any attempt to provide a const mac address to wilc_set_mac_address results
in the following warning:

warning: passing argument 2 of 'wilc_set_mac_address' discards 'const'
qualifier from pointer target type [-Wdiscarded-qualifiers]
[...]
drivers/net/wireless/microchip/wilc1000/hif.h:170:52: note: expected 'u8 *'
{aka 'unsigned char *'} but argument is of type 'const unsigned char *'a
int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr);

Instead of using an explicit cast each time we need provide a MAC address,
set the function parameter as const

Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://msgid.link/20240514-mac_addr_at_probe-v2-3-afef09f1cd10@bootlin.com
drivers/net/wireless/microchip/wilc1000/hif.c
drivers/net/wireless/microchip/wilc1000/hif.h
drivers/net/wireless/microchip/wilc1000/netdev.c

index 919de6ffb8217c54375df09f8ecde8e1bfa997bf..c6892b7e190fc46ddf953080e8668ba468d6ae15 100644 (file)
@@ -1293,7 +1293,7 @@ int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr)
        return result;
 }
 
-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr)
+int wilc_set_mac_address(struct wilc_vif *vif, const u8 *mac_addr)
 {
        struct wid wid;
        int result;
@@ -1301,7 +1301,7 @@ int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr)
        wid.id = WID_MAC_ADDR;
        wid.type = WID_STR;
        wid.size = ETH_ALEN;
-       wid.val = mac_addr;
+       wid.val = (u8 *)mac_addr;
 
        result = wilc_send_config_pkt(vif, WILC_SET_CFG, &wid, 1);
        if (result)
index 0d380586b1d9c91b71a37e9774ea6378c9276b5b..96eeaf31d23777e0392699240479b341529bfd42 100644 (file)
@@ -167,7 +167,7 @@ int wilc_add_rx_gtk(struct wilc_vif *vif, const u8 *rx_gtk, u8 gtk_key_len,
                    u8 cipher_mode);
 int wilc_set_pmkid_info(struct wilc_vif *vif, struct wilc_pmkid_attr *pmkid);
 int wilc_get_mac_address(struct wilc_vif *vif, u8 *mac_addr);
-int wilc_set_mac_address(struct wilc_vif *vif, u8 *mac_addr);
+int wilc_set_mac_address(struct wilc_vif *vif, const u8 *mac_addr);
 int wilc_set_join_req(struct wilc_vif *vif, u8 *bssid, const u8 *ies,
                      size_t ies_len);
 int wilc_disconnect(struct wilc_vif *vif);
index 166165ee7712ec0816db21dc543266a6508c34f1..2ee3d98278266b7ea5b277502fa4d5fa0bb62275 100644 (file)
@@ -678,7 +678,7 @@ static int wilc_set_mac_addr(struct net_device *dev, void *p)
        }
        rcu_read_unlock();
 
-       result = wilc_set_mac_address(vif, (u8 *)addr->sa_data);
+       result = wilc_set_mac_address(vif, addr->sa_data);
        if (result)
                return result;