fix build warnings on L6.9 kernel tree

When build wifi driver based on L6.9 kernel next tree, will observe the
following three different type build warnings. Need to add the code
changes here to avoid the build warnings.

/mwifiex/mlan/mlan_11h.c:1676:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
 1676 | t_u8 static wlan_11h_check_dfs_channel(mlan_adapter *pmadapter)
      | ^~~~
  CC [M]  /mwifiex/mlan/mlan_uap_cmdevent.o
/mwifiex/mlan/mlan_11h.c:1712:1: warning: ‘static’ is not at beginning of declaration [-Wold-style-declaration]
 1712 | mlan_status static wlan_11h_disable_dfs(mlan_private *priv, t_void *pioctl_buf)
      | ^~~~~~~~~~~

/mwifiex/mlinux/moal_eth_ioctl.c: In function ‘parse_arguments’:
/mwifiex/mlinux/moal_eth_ioctl.c:159:41: warning: suggest braces around empty body in an ‘if’ statement [-Wempty-body]
  159 |                                         ;
      |                                         ^

/mwifiex/mlinux/moal_eth_ioctl.c: In function ‘woal_priv_hssetpara.isra’:
/mwifiex/mlinux/moal_eth_ioctl.c:5159:17: warning: ‘snprintf’ argument 6 may overlap destination object ‘respbuf’ [-Wrestrict]
 5159 |                 snprintf(respbuf, CMD_BUF_LEN, "%s%s%s", CMD_NXP,
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5160 |                          PRIV_CMD_HSCFG,
      |                          ~~~~~~~~~~~~~~~
 5161 |                          respbuf + (strlen(CMD_NXP) +
      |                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 5162 |                                     strlen(PRIV_CMD_HSSETPARA)));
      |                                     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mwifiex/mlinux/moal_eth_ioctl.c:5131:58: note: destination object referenced by ‘restrict’-qualified argument 1 was declared here
 5131 | static int woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf,
      |                                                    ~~~~~~^~~~~~~

Signed-off-by: Sherry Sun <sherry.sun@nxp.com>
This commit is contained in:
Sherry Sun 2024-05-30 17:37:21 +08:00 committed by Luke Wang
parent 49fa879fe0
commit 88372772ba
2 changed files with 16 additions and 7 deletions

View file

@ -1673,7 +1673,7 @@ static t_bool wlan_11h_is_slave_on_dfs_chan(mlan_private *priv)
* @return MTRUE-dfs_master and dfs_slave interface on same DFS channel
*
*/
t_u8 static wlan_11h_check_dfs_channel(mlan_adapter *pmadapter)
static t_u8 wlan_11h_check_dfs_channel(mlan_adapter *pmadapter)
{
mlan_private *priv_master = MNULL;
mlan_private *priv_slave = MNULL;
@ -1709,7 +1709,7 @@ t_u8 static wlan_11h_check_dfs_channel(mlan_adapter *pmadapter)
*
* @return MLAN_STATUS_SUCCESS or MLAN_STATUS_FAILURE
*/
mlan_status static wlan_11h_disable_dfs(mlan_private *priv, t_void *pioctl_buf)
static mlan_status wlan_11h_disable_dfs(mlan_private *priv, t_void *pioctl_buf)
{
t_u32 enable = 0;
mlan_status ret = MLAN_STATUS_SUCCESS;

View file

@ -155,8 +155,8 @@ mlan_status parse_arguments(t_u8 *pos, int *data, int datalen,
is_hex = 0;
} else {
if (woal_atoi(&data[j], cdata) !=
MLAN_STATUS_SUCCESS)
;
MLAN_STATUS_SUCCESS) {
}
}
j++;
k = 0;
@ -5134,6 +5134,7 @@ static int woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf,
int data[15] = {0};
int user_data_len = 0;
int ret = 0;
t_u8 *buf = NULL;
ENTER();
@ -5156,12 +5157,20 @@ static int woal_priv_hssetpara(moal_private *priv, t_u8 *respbuf,
}
if (user_data_len >= 1 && user_data_len <= 15) {
buf = kzalloc(CMD_BUF_LEN, GFP_ATOMIC);
if (!buf) {
PRINTM(MERROR, "Could not allocate buffer\n");
LEAVE();
return -ENOMEM;
}
memcpy(buf, respbuf + (strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA)),
CMD_BUF_LEN - (strlen(CMD_NXP) + strlen(PRIV_CMD_HSSETPARA)));
snprintf(respbuf, CMD_BUF_LEN, "%s%s%s", CMD_NXP,
PRIV_CMD_HSCFG,
respbuf + (strlen(CMD_NXP) +
strlen(PRIV_CMD_HSSETPARA)));
PRIV_CMD_HSCFG, buf);
respbuflen = strlen(respbuf);
ret = woal_priv_hscfg(priv, respbuf, respbuflen, MFALSE);
kfree(buf);
goto done;
}
done: