* [PATCH] staging: wlan-ng: Remove unnecessary parentheses
@ 2017-10-16 18:26 Frank A. Cancio Bello
2017-10-18 10:45 ` kbuild test robot
0 siblings, 1 reply; 4+ messages in thread
From: Frank A. Cancio Bello @ 2017-10-16 18:26 UTC (permalink / raw)
To: pablo, Julia.Lawall; +Cc: gregkh, outreachy-kernel, devel
checkpatch message: 'CHECK: Unnecessary parentheses around'.
Signed-off-by: Frank A. Cancio Bello <frank@generalsoftwareinc.com>
---
FYI:
* I read 'Ignore checkpatch.pl if it complains about parens around boolean expressions or ternary conditionals in return values, like this: return ((depth > 1) ? (depth - 1) : depth);'. All the fixes in this patch are not in 'return values', so I hope there are OK ;)
drivers/staging/wlan-ng/cfg80211.c | 10 +++++-----
drivers/staging/wlan-ng/hfa384x_usb.c | 18 +++++++++---------
drivers/staging/wlan-ng/p80211conv.c | 6 +++---
drivers/staging/wlan-ng/p80211netdev.c | 4 ++--
4 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 178f6f5..03279aa 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -265,7 +265,7 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
memset(sinfo, 0, sizeof(*sinfo));
- if (!wlandev || (wlandev->msdstate != WLAN_MSD_RUNNING))
+ if (!wlandev || wlandev->msdstate != WLAN_MSD_RUNNING)
return -EOPNOTSUPP;
/* build request message */
@@ -367,8 +367,8 @@ static int prism2_scan(struct wiphy *wiphy,
msg2.bssindex.data = i;
result = p80211req_dorequest(wlandev, (u8 *)&msg2);
- if ((result != 0) ||
- (msg2.resultcode.data != P80211ENUM_resultcode_success)) {
+ if (result != 0 ||
+ msg2.resultcode.data != P80211ENUM_resultcode_success) {
break;
}
@@ -475,8 +475,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
}
/* Set the authorization */
- if ((sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) ||
- ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && !is_wep))
+ if (sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM ||
+ sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC && !is_wep)
msg_join.authtype.data = P80211ENUM_authalg_opensystem;
else if ((sme->auth_type == NL80211_AUTHTYPE_SHARED_KEY) ||
((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && is_wep))
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index d1e8218..b5fdfd8 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -1781,9 +1781,9 @@ int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport)
{
int result = 0;
- if ((!hw->isap && macport != 0) ||
- (hw->isap && !(macport <= HFA384x_PORTID_MAX)) ||
- (hw->port_enabled[macport])) {
+ if (!hw->isap && macport != 0 ||
+ hw->isap && !(macport <= HFA384x_PORTID_MAX) ||
+ hw->port_enabled[macport]) {
result = -EINVAL;
} else {
result = hfa384x_cmd_enable(hw, macport);
@@ -2465,7 +2465,7 @@ int hfa384x_drvr_start(struct hfa384x *hw)
netdev_err(hw->wlandev->netdev, "Cannot get bulk in endpoint status.\n");
goto done;
}
- if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_in))
+ if (status == 1 && usb_clear_halt(hw->usb, hw->endp_in))
netdev_err(hw->wlandev->netdev, "Failed to reset bulk in endpoint.\n");
result =
@@ -2474,7 +2474,7 @@ int hfa384x_drvr_start(struct hfa384x *hw)
netdev_err(hw->wlandev->netdev, "Cannot get bulk out endpoint status.\n");
goto done;
}
- if ((status == 1) && usb_clear_halt(hw->usb, hw->endp_out))
+ if (status == 1 && usb_clear_halt(hw->usb, hw->endp_out))
netdev_err(hw->wlandev->netdev, "Failed to reset bulk out endpoint.\n");
/* Synchronous unlink, in case we're trying to restart the driver */
@@ -3054,7 +3054,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
goto exit;
skb = hw->rx_urb_skb;
- if (!skb || (skb->data != urb->transfer_buffer)) {
+ if (!skb || skb->data != urb->transfer_buffer) {
WARN_ON(1);
return;
}
@@ -3501,8 +3501,8 @@ static void hfa384x_int_rxmonitor(struct wlandevice *wlandev,
return;
/* only prepend the prism header if in the right mode */
- if ((wlandev->netdev->type == ARPHRD_IEEE80211_PRISM) &&
- (hw->sniffhdr != 0)) {
+ if (wlandev->netdev->type == ARPHRD_IEEE80211_PRISM &&
+ hw->sniffhdr != 0) {
struct p80211_caphdr *caphdr;
/* The NEW header format! */
datap = skb_put(skb, sizeof(struct p80211_caphdr));
@@ -3772,7 +3772,7 @@ static void hfa384x_ctlxout_callback(struct urb *urb)
spin_unlock_irqrestore(&hw->ctlxq.lock, flags);
- if (!timer_ok && (hw->resp_timer_done == 0)) {
+ if (!timer_ok && hw->resp_timer_done == 0) {
spin_lock_irqsave(&hw->ctlxq.lock, flags);
goto delresp;
}
diff --git a/drivers/staging/wlan-ng/p80211conv.c b/drivers/staging/wlan-ng/p80211conv.c
index c1b6d42..bc63eb2 100644
--- a/drivers/staging/wlan-ng/p80211conv.c
+++ b/drivers/staging/wlan-ng/p80211conv.c
@@ -356,10 +356,10 @@ int skb_p80211_to_ether(struct wlandevice *wlandev, u32 ethconv,
sizeof(struct wlan_llc));
/* Test for the various encodings */
- if ((payload_length >= sizeof(struct wlan_ethhdr)) &&
+ if (payload_length >= sizeof(struct wlan_ethhdr) &&
(e_llc->dsap != 0xaa || e_llc->ssap != 0xaa) &&
- ((!ether_addr_equal_unaligned(daddr, e_hdr->daddr)) ||
- (!ether_addr_equal_unaligned(saddr, e_hdr->saddr)))) {
+ (!ether_addr_equal_unaligned(daddr, e_hdr->daddr) ||
+ !ether_addr_equal_unaligned(saddr, e_hdr->saddr))) {
pr_debug("802.3 ENCAP len: %d\n", payload_length);
/* 802.3 Encapsulated */
/* Test for an overlength frame */
diff --git a/drivers/staging/wlan-ng/p80211netdev.c b/drivers/staging/wlan-ng/p80211netdev.c
index 0f50365..ad11a3f 100644
--- a/drivers/staging/wlan-ng/p80211netdev.c
+++ b/drivers/staging/wlan-ng/p80211netdev.c
@@ -427,7 +427,7 @@ static int p80211knetdev_hard_start_xmit(struct sk_buff *skb,
failed:
/* Free up the WEP buffer if it's not the same as the skb */
- if ((p80211_wep.data) && (p80211_wep.data != skb->data))
+ if (p80211_wep.data && p80211_wep.data != skb->data)
kzfree(p80211_wep.data);
/* we always free the skb here, never in a lower level. */
@@ -491,7 +491,7 @@ static int p80211netdev_ethtool(struct wlandevice *wlandev,
edata.cmd = ethcmd;
if (wlandev->linkstatus &&
- (wlandev->macmode != WLAN_MACMODE_NONE)) {
+ wlandev->macmode != WLAN_MACMODE_NONE) {
edata.data = 1;
} else {
edata.data = 0;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] staging: wlan-ng: Remove unnecessary parentheses
2017-10-16 18:26 [PATCH] staging: wlan-ng: Remove unnecessary parentheses Frank A. Cancio Bello
@ 2017-10-18 10:45 ` kbuild test robot
0 siblings, 0 replies; 4+ messages in thread
From: kbuild test robot @ 2017-10-18 10:45 UTC (permalink / raw)
To: Frank A. Cancio Bello
Cc: kbuild-all, pablo, Julia.Lawall, devel, gregkh, outreachy-kernel
[-- Attachment #1: Type: text/plain, Size: 2782 bytes --]
Hi Frank,
[auto build test WARNING on staging/staging-testing]
[also build test WARNING on v4.14-rc5 next-20171017]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
url: https://github.com/0day-ci/linux/commits/Frank-A-Cancio-Bello/staging-wlan-ng-Remove-unnecessary-parentheses/20171018-180433
config: x86_64-randconfig-x005-201742 (attached as .config)
compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
All warnings (new ones prefixed by >>):
In file included from drivers/staging/wlan-ng/prism2usb.c:1:0:
drivers/staging/wlan-ng/hfa384x_usb.c: In function 'hfa384x_drvr_enable':
>> drivers/staging/wlan-ng/hfa384x_usb.c:1784:16: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
if (!hw->isap && macport != 0 ||
~~~~~~~~~~^~~~~~~~~~~~~~~
--
In file included from drivers/staging/wlan-ng/p80211netdev.c:91:0:
drivers/staging/wlan-ng/cfg80211.c: In function 'prism2_connect':
>> drivers/staging/wlan-ng/cfg80211.c:479:51: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC && !is_wep)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
vim +1784 drivers/staging/wlan-ng/hfa384x_usb.c
1756
1757 /*----------------------------------------------------------------
1758 * hfa384x_drvr_enable
1759 *
1760 * Issues the enable command to enable communications on one of
1761 * the MACs 'ports'. Only macport 0 is valid for stations.
1762 * APs may also enable macports 1-6. Only ports that are currently
1763 * disabled may be enabled.
1764 *
1765 * Arguments:
1766 * hw device structure
1767 * macport MAC port number
1768 *
1769 * Returns:
1770 * 0 success
1771 * >0 f/w reported failure - f/w status code
1772 * <0 driver reported error (timeout|bad arg)
1773 *
1774 * Side effects:
1775 *
1776 * Call context:
1777 * process
1778 *----------------------------------------------------------------
1779 */
1780 int hfa384x_drvr_enable(struct hfa384x *hw, u16 macport)
1781 {
1782 int result = 0;
1783
> 1784 if (!hw->isap && macport != 0 ||
1785 hw->isap && !(macport <= HFA384x_PORTID_MAX) ||
1786 hw->port_enabled[macport]) {
1787 result = -EINVAL;
1788 } else {
1789 result = hfa384x_cmd_enable(hw, macport);
1790 if (result == 0)
1791 hw->port_enabled[macport] = 1;
1792 }
1793 return result;
1794 }
1795
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 34774 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH]: staging: wlan-ng: Remove unnecessary Parentheses
@ 2023-03-25 0:22 Dalvin-Ehinoma Noah Aiguobas
2023-03-25 7:27 ` Dan Carpenter
0 siblings, 1 reply; 4+ messages in thread
From: Dalvin-Ehinoma Noah Aiguobas @ 2023-03-25 0:22 UTC (permalink / raw)
To: gregkh; +Cc: linux-staging, linux-kernel
Clean up Checkpatch issues by removing unnecessary Parentheses.
Signed-off-by: Dalvin-Ehinoma Noah Aiguobas <pharcodra@gmail.com>
---
drivers/staging/wlan-ng/cfg80211.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/wlan-ng/cfg80211.c b/drivers/staging/wlan-ng/cfg80211.c
index 471bb310176f..0b4d40ec7456 100644
--- a/drivers/staging/wlan-ng/cfg80211.c
+++ b/drivers/staging/wlan-ng/cfg80211.c
@@ -247,7 +247,7 @@ static int prism2_get_station(struct wiphy *wiphy, struct net_device *dev,
memset(sinfo, 0, sizeof(*sinfo));
- if (!wlandev || (wlandev->msdstate != WLAN_MSD_RUNNING))
+ if (!wlandev || wlandev->msdstate != WLAN_MSD_RUNNING)
return -EOPNOTSUPP;
/* build request message */
@@ -351,8 +351,8 @@ static int prism2_scan(struct wiphy *wiphy,
msg2->bssindex.data = i;
result = p80211req_dorequest(wlandev, (u8 *)&msg2);
- if ((result != 0) ||
- (msg2->resultcode.data != P80211ENUM_resultcode_success)) {
+ if (result != 0 ||
+ msg2->resultcode.data != P80211ENUM_resultcode_success) {
break;
}
@@ -459,8 +459,8 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
}
/* Set the authorization */
- if ((sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM) ||
- ((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && !is_wep))
+ if (sme->auth_type == NL80211_AUTHTYPE_OPEN_SYSTEM ||
+ (sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC && !is_wep))
msg_join.authtype.data = P80211ENUM_authalg_opensystem;
else if ((sme->auth_type == NL80211_AUTHTYPE_SHARED_KEY) ||
((sme->auth_type == NL80211_AUTHTYPE_AUTOMATIC) && is_wep))
@@ -478,7 +478,7 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
result = prism2_domibset_uint32(wlandev,
DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
- sme->key_idx);
+ sme->key_idx);
if (result)
goto exit;
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH]: staging: wlan-ng: Remove unnecessary Parentheses
2023-03-25 0:22 [PATCH]: staging: wlan-ng: Remove unnecessary Parentheses Dalvin-Ehinoma Noah Aiguobas
@ 2023-03-25 7:27 ` Dan Carpenter
0 siblings, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2023-03-25 7:27 UTC (permalink / raw)
To: Dalvin-Ehinoma Noah Aiguobas; +Cc: gregkh, linux-staging, linux-kernel
The subject has an extra : after the "[PATCH]:".
On Sat, Mar 25, 2023 at 01:22:25AM +0100, Dalvin-Ehinoma Noah Aiguobas wrote:
> Clean up Checkpatch issues by removing unnecessary Parentheses.
>
Just ignore checkpatch on this. Greg likes parentheses.
> @@ -478,7 +478,7 @@ static int prism2_connect(struct wiphy *wiphy, struct net_device *dev,
>
> result = prism2_domibset_uint32(wlandev,
> DIDMIB_DOT11SMT_PRIVACYTABLE_WEPDEFAULTKEYID,
> - sme->key_idx);
> + sme->key_idx);
Don't mix unrelated changes into the patch.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-03-25 7:27 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-25 0:22 [PATCH]: staging: wlan-ng: Remove unnecessary Parentheses Dalvin-Ehinoma Noah Aiguobas
2023-03-25 7:27 ` Dan Carpenter
-- strict thread matches above, loose matches on Subject: below --
2017-10-16 18:26 [PATCH] staging: wlan-ng: Remove unnecessary parentheses Frank A. Cancio Bello
2017-10-18 10:45 ` kbuild test robot
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.