netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] net: wan: sdla: Use bitwise instead of arithmetic
@ 2020-10-28  8:19 Zou Wei
  2020-10-30  8:58 ` Xie He
  0 siblings, 1 reply; 2+ messages in thread
From: Zou Wei @ 2020-10-28  8:19 UTC (permalink / raw)
  To: davem, kuba; +Cc: netdev, linux-kernel, Zou Wei

Fix the following coccinelle warnings:

./drivers/net/wan/sdla.c:841:38-39: WARNING: sum of probable bitmasks, consider |

Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Zou Wei <zou_wei@huawei.com>
---
 drivers/net/wan/sdla.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
index bc2c1c7..cf43f4c 100644
--- a/drivers/net/wan/sdla.c
+++ b/drivers/net/wan/sdla.c
@@ -838,7 +838,8 @@ static void sdla_receive(struct net_device *dev)
 		case SDLA_S502A:
 		case SDLA_S502E:
 			if (success)
-				__sdla_read(dev, SDLA_502_RCV_BUF + SDLA_502_DATA_OFS, skb_put(skb,len), len);
+				__sdla_read(dev, SDLA_502_RCV_BUF | SDLA_502_DATA_OFS,
+					    skb_put(skb, len), len);
 
 			SDLA_WINDOW(dev, SDLA_502_RCV_BUF);
 			cmd->opp_flag = 0;
-- 
2.6.2


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

* Re: [PATCH -next] net: wan: sdla: Use bitwise instead of arithmetic
  2020-10-28  8:19 [PATCH -next] net: wan: sdla: Use bitwise instead of arithmetic Zou Wei
@ 2020-10-30  8:58 ` Xie He
  0 siblings, 0 replies; 2+ messages in thread
From: Xie He @ 2020-10-30  8:58 UTC (permalink / raw)
  To: Zou Wei; +Cc: davem, kuba, netdev, linux-kernel

> Fix the following coccinelle warnings:
>
> ./drivers/net/wan/sdla.c:841:38-39: WARNING: sum of probable bitmasks, consider |
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Zou Wei <zou_wei@huawei.com>
> ---
>  drivers/net/wan/sdla.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/wan/sdla.c b/drivers/net/wan/sdla.c
> index bc2c1c7..cf43f4c 100644
> --- a/drivers/net/wan/sdla.c
> +++ b/drivers/net/wan/sdla.c
> @@ -838,7 +838,8 @@ static void sdla_receive(struct net_device *dev)
>  		case SDLA_S502A:
>  		case SDLA_S502E:
>  			if (success)
> -				__sdla_read(dev, SDLA_502_RCV_BUF + SDLA_502_DATA_OFS, skb_put(skb,len), len);
> +				__sdla_read(dev, SDLA_502_RCV_BUF | SDLA_502_DATA_OFS,
> +					    skb_put(skb, len), len);
>  
>  			SDLA_WINDOW(dev, SDLA_502_RCV_BUF);
>  			cmd->opp_flag = 0;

No, this is not a bit-OR. This is a sum. The argument is an address,
SDLA_502_RCV_BUF is a base address, SDLA_502_DATA_OFS is an offset.
They should be sumed instead of bit-OR'ed.

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

end of thread, other threads:[~2020-10-30  8:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-28  8:19 [PATCH -next] net: wan: sdla: Use bitwise instead of arithmetic Zou Wei
2020-10-30  8:58 ` Xie He

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