* [PATCH 0/4] treewide: Fix likely misuses of | for &
@ 2012-05-30 20:25 Joe Perches
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
To: linux-usb, linux-wireless; +Cc: linux-can, netdev, linux-kernel
| with a non-zero constant is always true.
Likely these should have been &.
Joe Perches (4):
mac80211: Fix likely misuse of | for &
can: cc770: Fix likely misuse of | for &
brcmfmac: Fix likely misuse of | for &
usb: gadget: pch_udc: Fix likely misuse of | for &
drivers/net/can/cc770/cc770_platform.c | 2 +-
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 4 ++--
drivers/usb/gadget/pch_udc.c | 2 +-
net/mac80211/cfg.c | 6 +++---
4 files changed, 7 insertions(+), 7 deletions(-)
--
1.7.8.111.gad25c.dirty
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 1/4] mac80211: Fix likely misuse of | for &
2012-05-30 20:25 [PATCH 0/4] treewide: Fix likely misuses of | for & Joe Perches
@ 2012-05-30 20:25 ` Joe Perches
2012-05-30 20:29 ` Ben Greear
2012-05-30 20:25 ` [PATCH 2/4] can: cc770: " Joe Perches
2012-05-30 20:25 ` [PATCH 3/4] brcmfmac: " Joe Perches
2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
To: John W. Linville, Johannes Berg
Cc: Ben Greear, David S. Miller, linux-wireless, netdev, linux-kernel
Using | with a constant is always true.
Likely this should have be &.
cc: Ben Greear <greearb@candelatech.com>
Signed-off-by: Joe Perches <joe@perches.com>
---
net/mac80211/cfg.c | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 495831e..e9cecca 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -533,16 +533,16 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
sinfo.filled = 0;
sta_set_sinfo(sta, &sinfo);
- if (sinfo.filled | STATION_INFO_TX_BITRATE)
+ if (sinfo.filled & STATION_INFO_TX_BITRATE)
data[i] = 100000 *
cfg80211_calculate_bitrate(&sinfo.txrate);
i++;
- if (sinfo.filled | STATION_INFO_RX_BITRATE)
+ if (sinfo.filled & STATION_INFO_RX_BITRATE)
data[i] = 100000 *
cfg80211_calculate_bitrate(&sinfo.rxrate);
i++;
- if (sinfo.filled | STATION_INFO_SIGNAL_AVG)
+ if (sinfo.filled & STATION_INFO_SIGNAL_AVG)
data[i] = (u8)sinfo.signal_avg;
i++;
} else {
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 2/4] can: cc770: Fix likely misuse of | for &
2012-05-30 20:25 [PATCH 0/4] treewide: Fix likely misuses of | for & Joe Perches
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
@ 2012-05-30 20:25 ` Joe Perches
2012-05-31 20:54 ` Marc Kleine-Budde
2012-05-30 20:25 ` [PATCH 3/4] brcmfmac: " Joe Perches
2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
To: linux-kernel; +Cc: Wolfgang Grandegger, Marc Kleine-Budde, linux-can, netdev
Using | with a constant is always true.
Likely this should have be &.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/can/cc770/cc770_platform.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
index 53115ee..688371c 100644
--- a/drivers/net/can/cc770/cc770_platform.c
+++ b/drivers/net/can/cc770/cc770_platform.c
@@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
struct cc770_platform_data *pdata = pdev->dev.platform_data;
priv->can.clock.freq = pdata->osc_freq;
- if (priv->cpu_interface | CPUIF_DSC)
+ if (priv->cpu_interface & CPUIF_DSC)
priv->can.clock.freq /= 2;
priv->clkout = pdata->cor;
priv->bus_config = pdata->bcr;
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 3/4] brcmfmac: Fix likely misuse of | for &
2012-05-30 20:25 [PATCH 0/4] treewide: Fix likely misuses of | for & Joe Perches
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
2012-05-30 20:25 ` [PATCH 2/4] can: cc770: " Joe Perches
@ 2012-05-30 20:25 ` Joe Perches
2012-05-30 20:50 ` Arend van Spriel
2 siblings, 1 reply; 7+ messages in thread
From: Joe Perches @ 2012-05-30 20:25 UTC (permalink / raw)
To: linux-kernel
Cc: Brett Rudley, Roland Vossen, Arend van Spriel,
Franky (Zhenhui) Lin, Kan Yan, John W. Linville, linux-wireless,
netdev
Using | with a constant is always true.
Likely this should have be &.
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
index e2480d1..8e7e692 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c
@@ -89,9 +89,9 @@ int brcmf_sdio_intr_register(struct brcmf_sdio_dev *sdiodev)
data |= 1 << SDIO_FUNC_1 | 1 << SDIO_FUNC_2 | 1;
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_IENx, data, &ret);
- /* redirect, configure ane enable io for interrupt signal */
+ /* redirect, configure and enable io for interrupt signal */
data = SDIO_SEPINT_MASK | SDIO_SEPINT_OE;
- if (sdiodev->irq_flags | IRQF_TRIGGER_HIGH)
+ if (sdiodev->irq_flags & IRQF_TRIGGER_HIGH)
data |= SDIO_SEPINT_ACT_HI;
brcmf_sdio_regwb(sdiodev, SDIO_CCCR_BRCM_SEPINT, data, &ret);
--
1.7.8.111.gad25c.dirty
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 1/4] mac80211: Fix likely misuse of | for &
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
@ 2012-05-30 20:29 ` Ben Greear
0 siblings, 0 replies; 7+ messages in thread
From: Ben Greear @ 2012-05-30 20:29 UTC (permalink / raw)
To: Joe Perches
Cc: John W. Linville, Johannes Berg, David S. Miller, linux-wireless,
netdev, linux-kernel
On 05/30/2012 01:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be&.
Yes, I think your change is correct. Looks like something
a compiler or static analysis tool could catch and warn about...
Sorry for the bug!
Ben
>
> cc: Ben Greear<greearb@candelatech.com>
> Signed-off-by: Joe Perches<joe@perches.com>
> ---
> net/mac80211/cfg.c | 6 +++---
> 1 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
> index 495831e..e9cecca 100644
> --- a/net/mac80211/cfg.c
> +++ b/net/mac80211/cfg.c
> @@ -533,16 +533,16 @@ static void ieee80211_get_et_stats(struct wiphy *wiphy,
> sinfo.filled = 0;
> sta_set_sinfo(sta,&sinfo);
>
> - if (sinfo.filled | STATION_INFO_TX_BITRATE)
> + if (sinfo.filled& STATION_INFO_TX_BITRATE)
> data[i] = 100000 *
> cfg80211_calculate_bitrate(&sinfo.txrate);
> i++;
> - if (sinfo.filled | STATION_INFO_RX_BITRATE)
> + if (sinfo.filled& STATION_INFO_RX_BITRATE)
> data[i] = 100000 *
> cfg80211_calculate_bitrate(&sinfo.rxrate);
> i++;
>
> - if (sinfo.filled | STATION_INFO_SIGNAL_AVG)
> + if (sinfo.filled& STATION_INFO_SIGNAL_AVG)
> data[i] = (u8)sinfo.signal_avg;
> i++;
> } else {
--
Ben Greear <greearb@candelatech.com>
Candela Technologies Inc http://www.candelatech.com
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 3/4] brcmfmac: Fix likely misuse of | for &
2012-05-30 20:25 ` [PATCH 3/4] brcmfmac: " Joe Perches
@ 2012-05-30 20:50 ` Arend van Spriel
0 siblings, 0 replies; 7+ messages in thread
From: Arend van Spriel @ 2012-05-30 20:50 UTC (permalink / raw)
To: Joe Perches
Cc: linux-kernel, Brett Rudley, Roland Vossen, Franky (Zhenhui) Lin,
Kan Yan, John W. Linville, linux-wireless, netdev
On 05/30/2012 10:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be &.
Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Joe Perches <joe@perches.com>
> ---
> drivers/net/wireless/brcm80211/brcmfmac/bcmsdh.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 2/4] can: cc770: Fix likely misuse of | for &
2012-05-30 20:25 ` [PATCH 2/4] can: cc770: " Joe Perches
@ 2012-05-31 20:54 ` Marc Kleine-Budde
0 siblings, 0 replies; 7+ messages in thread
From: Marc Kleine-Budde @ 2012-05-31 20:54 UTC (permalink / raw)
To: Joe Perches; +Cc: linux-kernel, Wolfgang Grandegger, linux-can, netdev
[-- Attachment #1: Type: text/plain, Size: 1330 bytes --]
On 05/30/2012 10:25 PM, Joe Perches wrote:
> Using | with a constant is always true.
> Likely this should have be &.
>
> Signed-off-by: Joe Perches <joe@perches.com>
Sounds reasonable. And there are no in tree users of the platform driver
that this fix could break.
commited to linux-can,
Marc
> ---
> drivers/net/can/cc770/cc770_platform.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/can/cc770/cc770_platform.c b/drivers/net/can/cc770/cc770_platform.c
> index 53115ee..688371c 100644
> --- a/drivers/net/can/cc770/cc770_platform.c
> +++ b/drivers/net/can/cc770/cc770_platform.c
> @@ -154,7 +154,7 @@ static int __devinit cc770_get_platform_data(struct platform_device *pdev,
> struct cc770_platform_data *pdata = pdev->dev.platform_data;
>
> priv->can.clock.freq = pdata->osc_freq;
> - if (priv->cpu_interface | CPUIF_DSC)
> + if (priv->cpu_interface & CPUIF_DSC)
> priv->can.clock.freq /= 2;
> priv->clkout = pdata->cor;
> priv->bus_config = pdata->bcr;
--
Pengutronix e.K. | Marc Kleine-Budde |
Industrial Linux Solutions | Phone: +49-231-2826-924 |
Vertretung West/Dortmund | Fax: +49-5121-206917-5555 |
Amtsgericht Hildesheim, HRA 2686 | http://www.pengutronix.de |
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 262 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-31 20:54 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-30 20:25 [PATCH 0/4] treewide: Fix likely misuses of | for & Joe Perches
2012-05-30 20:25 ` [PATCH 1/4] mac80211: Fix likely misuse " Joe Perches
2012-05-30 20:29 ` Ben Greear
2012-05-30 20:25 ` [PATCH 2/4] can: cc770: " Joe Perches
2012-05-31 20:54 ` Marc Kleine-Budde
2012-05-30 20:25 ` [PATCH 3/4] brcmfmac: " Joe Perches
2012-05-30 20:50 ` Arend van Spriel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).