2022-04-07 06:34:03

by Alaa Mohamed

[permalink] [raw]
Subject: [PATCH v3] staging: rtl8712: remove unnecessary parentheses

Reported by checkpatch:

CHECK: Unnecessary parentheses around param->u.crypt.key[16]: 85
CHECK: Unnecessary parentheses around param->u.crypt.key[24]: 87
CHECK: Unnecessary parentheses around padapter->mlmepriv: 603
CHECK: Unnecessary parentheses around wrqu->encoding: 1497
CHECK: Unnecessary parentheses around wrqu->encoding: 1592
CHECK: Unnecessary parentheses around padapter->mlmepriv: 1593
CHECK: Unnecessary parentheses around wrqu->param: 1673
CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1967
CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1977
CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1999

Signed-off-by: Alaa Mohamed <[email protected]>
---
Changes in v2:
- Edit commit subject
- Edit commit message
- Fix the same check in more lines
- Remove space before '.skey' in
"memcpy(psta->tkiptxmickey.skey," in lines 84 and 86.
---
Changes in v3:
return the space before '.skey' in
"memcpy(psta->tkiptxmickey.skey," in lines 84 and 86
---
drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 20 +++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
index 3b6926613257..f1e352b7f83e 100644
--- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
+++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
@@ -82,9 +82,9 @@ static inline void handle_pairwise_key(struct sta_info *psta,
(param->u.crypt. key_len > 16 ? 16 : param->u.crypt.key_len));
if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
memcpy(psta->tkiptxmickey. skey,
- &(param->u.crypt.key[16]), 8);
+ &param->u.crypt.key[16], 8);
memcpy(psta->tkiprxmickey. skey,
- &(param->u.crypt.key[24]), 8);
+ &param->u.crypt.key[24], 8);
padapter->securitypriv. busetkipkey = false;
mod_timer(&padapter->securitypriv.tkip_timer,
jiffies + msecs_to_jiffies(50));
@@ -600,7 +600,7 @@ static int r8711_wx_get_name(struct net_device *dev,
u32 ht_ielen = 0;
char *p;
u8 ht_cap = false;
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
u8 *prates;

@@ -1494,7 +1494,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
u32 keyindex_provided;
struct NDIS_802_11_WEP wep;
enum NDIS_802_11_AUTHENTICATION_MODE authmode;
- struct iw_point *erq = &(wrqu->encoding);
+ struct iw_point *erq = &wrqu->encoding;
struct _adapter *padapter = netdev_priv(dev);

key = erq->flags & IW_ENCODE_INDEX;
@@ -1589,8 +1589,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
{
uint key;
struct _adapter *padapter = netdev_priv(dev);
- struct iw_point *erq = &(wrqu->encoding);
- struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
+ struct iw_point *erq = &wrqu->encoding;
+ struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
union Keytype *dk = padapter->securitypriv.DefKey;

if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
@@ -1670,7 +1670,7 @@ static int r871x_wx_set_auth(struct net_device *dev,
union iwreq_data *wrqu, char *extra)
{
struct _adapter *padapter = netdev_priv(dev);
- struct iw_param *param = (struct iw_param *)&(wrqu->param);
+ struct iw_param *param = (struct iw_param *)&wrqu->param;
int paramid;
int paramval;
int ret = 0;
@@ -1964,7 +1964,7 @@ static int r871x_get_ap_info(struct net_device *dev,
return -EINVAL;
data[32] = 0;

- spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
+ spin_lock_irqsave(&pmlmepriv->scanned_queue.lock, irqL);
phead = &queue->queue;
plist = phead->next;
while (1) {
@@ -1974,7 +1974,7 @@ static int r871x_get_ap_info(struct net_device *dev,
if (!mac_pton(data, bssid)) {
netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
(u8 *)data);
- spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
+ spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock,
irqL);
return -EINVAL;
}
@@ -1996,7 +1996,7 @@ static int r871x_get_ap_info(struct net_device *dev,
}
plist = plist->next;
}
- spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
+ spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock, irqL);
if (pdata->length >= 34) {
if (copy_to_user((u8 __user *)pdata->pointer + 32,
(u8 *)&pdata->flags, 1))
--
2.35.1


2022-04-07 19:37:21

by Alaa Mohamed

[permalink] [raw]
Subject: Re: [PATCH v3] staging: rtl8712: remove unnecessary parentheses


On ٧‏/٤‏/٢٠٢٢ ١٤:٣٩, Julia Lawall wrote:
>
> On Thu, 7 Apr 2022, Alaa Mohamed wrote:
>
>> On ٧/٤/٢٠٢٢ ٠٦:٠٦, Julia Lawall wrote:
>>> On Thu, 7 Apr 2022, Alaa Mohamed wrote:
>>>
>>>> Reported by checkpatch:
>>>>
>>>> CHECK: Unnecessary parentheses around param->u.crypt.key[16]: 85
>>>> CHECK: Unnecessary parentheses around param->u.crypt.key[24]: 87
>>>> CHECK: Unnecessary parentheses around padapter->mlmepriv: 603
>>>> CHECK: Unnecessary parentheses around wrqu->encoding: 1497
>>>> CHECK: Unnecessary parentheses around wrqu->encoding: 1592
>>>> CHECK: Unnecessary parentheses around padapter->mlmepriv: 1593
>>>> CHECK: Unnecessary parentheses around wrqu->param: 1673
>>>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1967
>>>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1977
>>>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1999
>>> This still needs to be improved.
>> Should be something like :
>>
>> CHECK: Unnecessary parentheses '(' around struct
> That seems like a good direction, thanks. Maybe "Remove unnecessary
> parentheses around structure field references"
It is better , Thank you :)
> julia
>
>> ?
>>>> Signed-off-by: Alaa Mohamed <[email protected]>
>>>> ---
>>>> Changes in v2:
>>>> - Edit commit subject
>>>> - Edit commit message
>>>> - Fix the same check in more lines
>>>> - Remove space before '.skey' in
>>>> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86.
>>>> ---
>>>> Changes in v3:
>>>> return the space before '.skey' in
>>>> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86
>>> Thanks for taking care of this part.
>>>
>>> julia
>>>
>>>> ---
>>>> drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 20 +++++++++----------
>>>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>>>
>>>> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>>>> b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>>>> index 3b6926613257..f1e352b7f83e 100644
>>>> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>>>> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>>>> @@ -82,9 +82,9 @@ static inline void handle_pairwise_key(struct sta_info
>>>> *psta,
>>>> (param->u.crypt. key_len > 16 ? 16 : param->u.crypt.key_len));
>>>> if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
>>>> memcpy(psta->tkiptxmickey. skey,
>>>> - &(param->u.crypt.key[16]), 8);
>>>> + &param->u.crypt.key[16], 8);
>>>> memcpy(psta->tkiprxmickey. skey,
>>>> - &(param->u.crypt.key[24]), 8);
>>>> + &param->u.crypt.key[24], 8);
>>>> padapter->securitypriv. busetkipkey = false;
>>>> mod_timer(&padapter->securitypriv.tkip_timer,
>>>> jiffies + msecs_to_jiffies(50));
>>>> @@ -600,7 +600,7 @@ static int r8711_wx_get_name(struct net_device *dev,
>>>> u32 ht_ielen = 0;
>>>> char *p;
>>>> u8 ht_cap = false;
>>>> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>>>> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>>>> struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
>>>> u8 *prates;
>>>>
>>>> @@ -1494,7 +1494,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
>>>> u32 keyindex_provided;
>>>> struct NDIS_802_11_WEP wep;
>>>> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
>>>> - struct iw_point *erq = &(wrqu->encoding);
>>>> + struct iw_point *erq = &wrqu->encoding;
>>>> struct _adapter *padapter = netdev_priv(dev);
>>>>
>>>> key = erq->flags & IW_ENCODE_INDEX;
>>>> @@ -1589,8 +1589,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
>>>> {
>>>> uint key;
>>>> struct _adapter *padapter = netdev_priv(dev);
>>>> - struct iw_point *erq = &(wrqu->encoding);
>>>> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>>>> + struct iw_point *erq = &wrqu->encoding;
>>>> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>>>> union Keytype *dk = padapter->securitypriv.DefKey;
>>>>
>>>> if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
>>>> @@ -1670,7 +1670,7 @@ static int r871x_wx_set_auth(struct net_device *dev,
>>>> union iwreq_data *wrqu, char *extra)
>>>> {
>>>> struct _adapter *padapter = netdev_priv(dev);
>>>> - struct iw_param *param = (struct iw_param *)&(wrqu->param);
>>>> + struct iw_param *param = (struct iw_param *)&wrqu->param;
>>>> int paramid;
>>>> int paramval;
>>>> int ret = 0;
>>>> @@ -1964,7 +1964,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>>>> return -EINVAL;
>>>> data[32] = 0;
>>>>
>>>> - spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
>>>> + spin_lock_irqsave(&pmlmepriv->scanned_queue.lock, irqL);
>>>> phead = &queue->queue;
>>>> plist = phead->next;
>>>> while (1) {
>>>> @@ -1974,7 +1974,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>>>> if (!mac_pton(data, bssid)) {
>>>> netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
>>>> (u8 *)data);
>>>> -
>>>> spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
>>>> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock,
>>>> irqL);
>>>> return -EINVAL;
>>>> }
>>>> @@ -1996,7 +1996,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>>>> }
>>>> plist = plist->next;
>>>> }
>>>> - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
>>>> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock, irqL);
>>>> if (pdata->length >= 34) {
>>>> if (copy_to_user((u8 __user *)pdata->pointer + 32,
>>>> (u8 *)&pdata->flags, 1))
>>>> --
>>>> 2.35.1
>>>>
>>>>
>>>>
> >

2022-04-07 20:13:19

by Alaa Mohamed

[permalink] [raw]
Subject: Re: [PATCH v3] staging: rtl8712: remove unnecessary parentheses


On ٧‏/٤‏/٢٠٢٢ ٠٦:٠٦, Julia Lawall wrote:
>
> On Thu, 7 Apr 2022, Alaa Mohamed wrote:
>
>> Reported by checkpatch:
>>
>> CHECK: Unnecessary parentheses around param->u.crypt.key[16]: 85
>> CHECK: Unnecessary parentheses around param->u.crypt.key[24]: 87
>> CHECK: Unnecessary parentheses around padapter->mlmepriv: 603
>> CHECK: Unnecessary parentheses around wrqu->encoding: 1497
>> CHECK: Unnecessary parentheses around wrqu->encoding: 1592
>> CHECK: Unnecessary parentheses around padapter->mlmepriv: 1593
>> CHECK: Unnecessary parentheses around wrqu->param: 1673
>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1967
>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1977
>> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1999
> This still needs to be improved.

Should be something like :

CHECK: Unnecessary parentheses '(' around struct

?
>
>> Signed-off-by: Alaa Mohamed <[email protected]>
>> ---
>> Changes in v2:
>> - Edit commit subject
>> - Edit commit message
>> - Fix the same check in more lines
>> - Remove space before '.skey' in
>> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86.
>> ---
>> Changes in v3:
>> return the space before '.skey' in
>> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86
> Thanks for taking care of this part.
>
> julia
>
>> ---
>> drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 20 +++++++++----------
>> 1 file changed, 10 insertions(+), 10 deletions(-)
>>
>> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> index 3b6926613257..f1e352b7f83e 100644
>> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
>> @@ -82,9 +82,9 @@ static inline void handle_pairwise_key(struct sta_info *psta,
>> (param->u.crypt. key_len > 16 ? 16 : param->u.crypt.key_len));
>> if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
>> memcpy(psta->tkiptxmickey. skey,
>> - &(param->u.crypt.key[16]), 8);
>> + &param->u.crypt.key[16], 8);
>> memcpy(psta->tkiprxmickey. skey,
>> - &(param->u.crypt.key[24]), 8);
>> + &param->u.crypt.key[24], 8);
>> padapter->securitypriv. busetkipkey = false;
>> mod_timer(&padapter->securitypriv.tkip_timer,
>> jiffies + msecs_to_jiffies(50));
>> @@ -600,7 +600,7 @@ static int r8711_wx_get_name(struct net_device *dev,
>> u32 ht_ielen = 0;
>> char *p;
>> u8 ht_cap = false;
>> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>> struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
>> u8 *prates;
>>
>> @@ -1494,7 +1494,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
>> u32 keyindex_provided;
>> struct NDIS_802_11_WEP wep;
>> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
>> - struct iw_point *erq = &(wrqu->encoding);
>> + struct iw_point *erq = &wrqu->encoding;
>> struct _adapter *padapter = netdev_priv(dev);
>>
>> key = erq->flags & IW_ENCODE_INDEX;
>> @@ -1589,8 +1589,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
>> {
>> uint key;
>> struct _adapter *padapter = netdev_priv(dev);
>> - struct iw_point *erq = &(wrqu->encoding);
>> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
>> + struct iw_point *erq = &wrqu->encoding;
>> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
>> union Keytype *dk = padapter->securitypriv.DefKey;
>>
>> if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
>> @@ -1670,7 +1670,7 @@ static int r871x_wx_set_auth(struct net_device *dev,
>> union iwreq_data *wrqu, char *extra)
>> {
>> struct _adapter *padapter = netdev_priv(dev);
>> - struct iw_param *param = (struct iw_param *)&(wrqu->param);
>> + struct iw_param *param = (struct iw_param *)&wrqu->param;
>> int paramid;
>> int paramval;
>> int ret = 0;
>> @@ -1964,7 +1964,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>> return -EINVAL;
>> data[32] = 0;
>>
>> - spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
>> + spin_lock_irqsave(&pmlmepriv->scanned_queue.lock, irqL);
>> phead = &queue->queue;
>> plist = phead->next;
>> while (1) {
>> @@ -1974,7 +1974,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>> if (!mac_pton(data, bssid)) {
>> netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
>> (u8 *)data);
>> - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
>> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock,
>> irqL);
>> return -EINVAL;
>> }
>> @@ -1996,7 +1996,7 @@ static int r871x_get_ap_info(struct net_device *dev,
>> }
>> plist = plist->next;
>> }
>> - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
>> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock, irqL);
>> if (pdata->length >= 34) {
>> if (copy_to_user((u8 __user *)pdata->pointer + 32,
>> (u8 *)&pdata->flags, 1))
>> --
>> 2.35.1
>>
>>
>>

2022-04-07 20:35:01

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH v3] staging: rtl8712: remove unnecessary parentheses



On Thu, 7 Apr 2022, Alaa Mohamed wrote:

>
> On ٧/٤/٢٠٢٢ ٠٦:٠٦, Julia Lawall wrote:
> >
> > On Thu, 7 Apr 2022, Alaa Mohamed wrote:
> >
> > > Reported by checkpatch:
> > >
> > > CHECK: Unnecessary parentheses around param->u.crypt.key[16]: 85
> > > CHECK: Unnecessary parentheses around param->u.crypt.key[24]: 87
> > > CHECK: Unnecessary parentheses around padapter->mlmepriv: 603
> > > CHECK: Unnecessary parentheses around wrqu->encoding: 1497
> > > CHECK: Unnecessary parentheses around wrqu->encoding: 1592
> > > CHECK: Unnecessary parentheses around padapter->mlmepriv: 1593
> > > CHECK: Unnecessary parentheses around wrqu->param: 1673
> > > CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1967
> > > CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1977
> > > CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1999
> > This still needs to be improved.
>
> Should be something like :
>
> CHECK: Unnecessary parentheses '(' around struct

That seems like a good direction, thanks. Maybe "Remove unnecessary
parentheses around structure field references"

julia

>
> ?
> >
> > > Signed-off-by: Alaa Mohamed <[email protected]>
> > > ---
> > > Changes in v2:
> > > - Edit commit subject
> > > - Edit commit message
> > > - Fix the same check in more lines
> > > - Remove space before '.skey' in
> > > "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86.
> > > ---
> > > Changes in v3:
> > > return the space before '.skey' in
> > > "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86
> > Thanks for taking care of this part.
> >
> > julia
> >
> > > ---
> > > drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 20 +++++++++----------
> > > 1 file changed, 10 insertions(+), 10 deletions(-)
> > >
> > > diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > > b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > > index 3b6926613257..f1e352b7f83e 100644
> > > --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > > +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> > > @@ -82,9 +82,9 @@ static inline void handle_pairwise_key(struct sta_info
> > > *psta,
> > > (param->u.crypt. key_len > 16 ? 16 : param->u.crypt.key_len));
> > > if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
> > > memcpy(psta->tkiptxmickey. skey,
> > > - &(param->u.crypt.key[16]), 8);
> > > + &param->u.crypt.key[16], 8);
> > > memcpy(psta->tkiprxmickey. skey,
> > > - &(param->u.crypt.key[24]), 8);
> > > + &param->u.crypt.key[24], 8);
> > > padapter->securitypriv. busetkipkey = false;
> > > mod_timer(&padapter->securitypriv.tkip_timer,
> > > jiffies + msecs_to_jiffies(50));
> > > @@ -600,7 +600,7 @@ static int r8711_wx_get_name(struct net_device *dev,
> > > u32 ht_ielen = 0;
> > > char *p;
> > > u8 ht_cap = false;
> > > - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
> > > + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> > > struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
> > > u8 *prates;
> > >
> > > @@ -1494,7 +1494,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
> > > u32 keyindex_provided;
> > > struct NDIS_802_11_WEP wep;
> > > enum NDIS_802_11_AUTHENTICATION_MODE authmode;
> > > - struct iw_point *erq = &(wrqu->encoding);
> > > + struct iw_point *erq = &wrqu->encoding;
> > > struct _adapter *padapter = netdev_priv(dev);
> > >
> > > key = erq->flags & IW_ENCODE_INDEX;
> > > @@ -1589,8 +1589,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
> > > {
> > > uint key;
> > > struct _adapter *padapter = netdev_priv(dev);
> > > - struct iw_point *erq = &(wrqu->encoding);
> > > - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
> > > + struct iw_point *erq = &wrqu->encoding;
> > > + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> > > union Keytype *dk = padapter->securitypriv.DefKey;
> > >
> > > if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
> > > @@ -1670,7 +1670,7 @@ static int r871x_wx_set_auth(struct net_device *dev,
> > > union iwreq_data *wrqu, char *extra)
> > > {
> > > struct _adapter *padapter = netdev_priv(dev);
> > > - struct iw_param *param = (struct iw_param *)&(wrqu->param);
> > > + struct iw_param *param = (struct iw_param *)&wrqu->param;
> > > int paramid;
> > > int paramval;
> > > int ret = 0;
> > > @@ -1964,7 +1964,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> > > return -EINVAL;
> > > data[32] = 0;
> > >
> > > - spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
> > > + spin_lock_irqsave(&pmlmepriv->scanned_queue.lock, irqL);
> > > phead = &queue->queue;
> > > plist = phead->next;
> > > while (1) {
> > > @@ -1974,7 +1974,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> > > if (!mac_pton(data, bssid)) {
> > > netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
> > > (u8 *)data);
> > > -
> > > spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
> > > + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock,
> > > irqL);
> > > return -EINVAL;
> > > }
> > > @@ -1996,7 +1996,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> > > }
> > > plist = plist->next;
> > > }
> > > - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
> > > + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock, irqL);
> > > if (pdata->length >= 34) {
> > > if (copy_to_user((u8 __user *)pdata->pointer + 32,
> > > (u8 *)&pdata->flags, 1))
> > > --
> > > 2.35.1
> > >
> > >
> > >
>

2022-04-07 20:58:38

by Julia Lawall

[permalink] [raw]
Subject: Re: [PATCH v3] staging: rtl8712: remove unnecessary parentheses



On Thu, 7 Apr 2022, Alaa Mohamed wrote:

> Reported by checkpatch:
>
> CHECK: Unnecessary parentheses around param->u.crypt.key[16]: 85
> CHECK: Unnecessary parentheses around param->u.crypt.key[24]: 87
> CHECK: Unnecessary parentheses around padapter->mlmepriv: 603
> CHECK: Unnecessary parentheses around wrqu->encoding: 1497
> CHECK: Unnecessary parentheses around wrqu->encoding: 1592
> CHECK: Unnecessary parentheses around padapter->mlmepriv: 1593
> CHECK: Unnecessary parentheses around wrqu->param: 1673
> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1967
> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1977
> CHECK: Unnecessary parentheses around pmlmepriv->scanned_queue.lock: 1999

This still needs to be improved.

> Signed-off-by: Alaa Mohamed <[email protected]>
> ---
> Changes in v2:
> - Edit commit subject
> - Edit commit message
> - Fix the same check in more lines
> - Remove space before '.skey' in
> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86.
> ---
> Changes in v3:
> return the space before '.skey' in
> "memcpy(psta->tkiptxmickey.skey," in lines 84 and 86

Thanks for taking care of this part.

julia

> ---
> drivers/staging/rtl8712/rtl871x_ioctl_linux.c | 20 +++++++++----------
> 1 file changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> index 3b6926613257..f1e352b7f83e 100644
> --- a/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> +++ b/drivers/staging/rtl8712/rtl871x_ioctl_linux.c
> @@ -82,9 +82,9 @@ static inline void handle_pairwise_key(struct sta_info *psta,
> (param->u.crypt. key_len > 16 ? 16 : param->u.crypt.key_len));
> if (strcmp(param->u.crypt.alg, "TKIP") == 0) { /* set mic key */
> memcpy(psta->tkiptxmickey. skey,
> - &(param->u.crypt.key[16]), 8);
> + &param->u.crypt.key[16], 8);
> memcpy(psta->tkiprxmickey. skey,
> - &(param->u.crypt.key[24]), 8);
> + &param->u.crypt.key[24], 8);
> padapter->securitypriv. busetkipkey = false;
> mod_timer(&padapter->securitypriv.tkip_timer,
> jiffies + msecs_to_jiffies(50));
> @@ -600,7 +600,7 @@ static int r8711_wx_get_name(struct net_device *dev,
> u32 ht_ielen = 0;
> char *p;
> u8 ht_cap = false;
> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network;
> u8 *prates;
>
> @@ -1494,7 +1494,7 @@ static int r8711_wx_set_enc(struct net_device *dev,
> u32 keyindex_provided;
> struct NDIS_802_11_WEP wep;
> enum NDIS_802_11_AUTHENTICATION_MODE authmode;
> - struct iw_point *erq = &(wrqu->encoding);
> + struct iw_point *erq = &wrqu->encoding;
> struct _adapter *padapter = netdev_priv(dev);
>
> key = erq->flags & IW_ENCODE_INDEX;
> @@ -1589,8 +1589,8 @@ static int r8711_wx_get_enc(struct net_device *dev,
> {
> uint key;
> struct _adapter *padapter = netdev_priv(dev);
> - struct iw_point *erq = &(wrqu->encoding);
> - struct mlme_priv *pmlmepriv = &(padapter->mlmepriv);
> + struct iw_point *erq = &wrqu->encoding;
> + struct mlme_priv *pmlmepriv = &padapter->mlmepriv;
> union Keytype *dk = padapter->securitypriv.DefKey;
>
> if (!check_fwstate(pmlmepriv, _FW_LINKED)) {
> @@ -1670,7 +1670,7 @@ static int r871x_wx_set_auth(struct net_device *dev,
> union iwreq_data *wrqu, char *extra)
> {
> struct _adapter *padapter = netdev_priv(dev);
> - struct iw_param *param = (struct iw_param *)&(wrqu->param);
> + struct iw_param *param = (struct iw_param *)&wrqu->param;
> int paramid;
> int paramval;
> int ret = 0;
> @@ -1964,7 +1964,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> return -EINVAL;
> data[32] = 0;
>
> - spin_lock_irqsave(&(pmlmepriv->scanned_queue.lock), irqL);
> + spin_lock_irqsave(&pmlmepriv->scanned_queue.lock, irqL);
> phead = &queue->queue;
> plist = phead->next;
> while (1) {
> @@ -1974,7 +1974,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> if (!mac_pton(data, bssid)) {
> netdev_info(dev, "r8712u: Invalid BSSID '%s'.\n",
> (u8 *)data);
> - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock),
> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock,
> irqL);
> return -EINVAL;
> }
> @@ -1996,7 +1996,7 @@ static int r871x_get_ap_info(struct net_device *dev,
> }
> plist = plist->next;
> }
> - spin_unlock_irqrestore(&(pmlmepriv->scanned_queue.lock), irqL);
> + spin_unlock_irqrestore(&pmlmepriv->scanned_queue.lock, irqL);
> if (pdata->length >= 34) {
> if (copy_to_user((u8 __user *)pdata->pointer + 32,
> (u8 *)&pdata->flags, 1))
> --
> 2.35.1
>
>
>