staging: rtl8192u: Constify ieee80211_qos_parameters structure

Declare ieee80211_qos_parameters structure constant it is only passed
as src parameter to the function memcpy. The fields of
def_qos_parameters structure are never modified and hence it can be
declared as const.

Coccinelle Script:

@r1 disable optional_qualifier@
identifier i;
position p;
@@

static struct ieee80211_qos_parameters i@p ={...};

@ok1@
identifier r1.i;
position p;
expression e1,e2;
@@
memcpy(e1,&i@p,e2)

@bad@
position p!={r1.p,ok1.p};
identifier r1.i;
@@
i@p

@depends on !bad disable optional_qualifier@
identifier r1.i;
@@
static
+const
struct ieee80211_qos_parameters i={...};

Signed-off-by: Gargi Sharma <gs051095@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Gargi Sharma 2017-03-02 11:16:14 +05:30 committed by Greg Kroah-Hartman
parent 08680307eb
commit feb254a7b5
1 changed files with 1 additions and 1 deletions

View File

@ -1814,7 +1814,7 @@ static void rtl8192_link_change(struct net_device *dev)
}
}
static struct ieee80211_qos_parameters def_qos_parameters = {
static const struct ieee80211_qos_parameters def_qos_parameters = {
{cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3), cpu_to_le16(3)},
{cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7), cpu_to_le16(7)},
{2, 2, 2, 2},/* aifs */