linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] firewire: Use bitwise instead of arithmetic operator for flags
@ 2021-03-09  7:11 Jiapeng Chong
  2021-03-14  9:20 ` Stefan Richter
  0 siblings, 1 reply; 2+ messages in thread
From: Jiapeng Chong @ 2021-03-09  7:11 UTC (permalink / raw)
  To: stefanr; +Cc: linux1394-devel, linux-kernel, Jiapeng Chong

Fix the following coccicheck warnings:

./drivers/firewire/core-device.c:973:22-23: WARNING: sum of probable
bitmasks, consider |.

./drivers/firewire/core-device.c:954:22-23: WARNING: sum of probable
bitmasks, consider |.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
 drivers/firewire/core-device.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
index 6821698..e04832d 100644
--- a/drivers/firewire/core-device.c
+++ b/drivers/firewire/core-device.c
@@ -951,7 +951,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
 	if (device->bc_implemented == BC_UNKNOWN) {
 		rcode = fw_run_transaction(card, TCODE_READ_QUADLET_REQUEST,
 				device->node_id, generation, device->max_speed,
-				CSR_REGISTER_BASE + CSR_BROADCAST_CHANNEL,
+				CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL,
 				&data, 4);
 		switch (rcode) {
 		case RCODE_COMPLETE:
@@ -970,7 +970,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
 				   BROADCAST_CHANNEL_VALID);
 		fw_run_transaction(card, TCODE_WRITE_QUADLET_REQUEST,
 				device->node_id, generation, device->max_speed,
-				CSR_REGISTER_BASE + CSR_BROADCAST_CHANNEL,
+				CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL,
 				&data, 4);
 	}
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] firewire: Use bitwise instead of arithmetic operator for flags
  2021-03-09  7:11 [PATCH] firewire: Use bitwise instead of arithmetic operator for flags Jiapeng Chong
@ 2021-03-14  9:20 ` Stefan Richter
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Richter @ 2021-03-14  9:20 UTC (permalink / raw)
  To: Jiapeng Chong; +Cc: linux1394-devel, linux-kernel

On Mar 09 Jiapeng Chong wrote:
> Fix the following coccicheck warnings:
> 
> ./drivers/firewire/core-device.c:973:22-23: WARNING: sum of probable
> bitmasks, consider |.
> 
> ./drivers/firewire/core-device.c:954:22-23: WARNING: sum of probable
> bitmasks, consider |.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
> ---
>  drivers/firewire/core-device.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/firewire/core-device.c b/drivers/firewire/core-device.c
> index 6821698..e04832d 100644
> --- a/drivers/firewire/core-device.c
> +++ b/drivers/firewire/core-device.c
> @@ -951,7 +951,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
>  	if (device->bc_implemented == BC_UNKNOWN) {
>  		rcode = fw_run_transaction(card, TCODE_READ_QUADLET_REQUEST,
>  				device->node_id, generation, device->max_speed,
> -				CSR_REGISTER_BASE + CSR_BROADCAST_CHANNEL,
> +				CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL,
>  				&data, 4);
>  		switch (rcode) {
>  		case RCODE_COMPLETE:
> @@ -970,7 +970,7 @@ static void set_broadcast_channel(struct fw_device *device, int generation)
>  				   BROADCAST_CHANNEL_VALID);
>  		fw_run_transaction(card, TCODE_WRITE_QUADLET_REQUEST,
>  				device->node_id, generation, device->max_speed,
> -				CSR_REGISTER_BASE + CSR_BROADCAST_CHANNEL,
> +				CSR_REGISTER_BASE | CSR_BROADCAST_CHANNEL,
>  				&data, 4);
>  	}
>  }

It's "base address + address offset". The arithmetic operator is correct.
-- 
Stefan Richter
-======--=-= --== -===-
http://arcgraph.de/sr/

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-14  9:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-09  7:11 [PATCH] firewire: Use bitwise instead of arithmetic operator for flags Jiapeng Chong
2021-03-14  9:20 ` Stefan Richter

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).