diff mbox series

[-next] net: wan: sdla: Use bitwise instead of arithmetic

Message ID 1603873191-106077-1-git-send-email-zou_wei@huawei.com
State Rejected
Delegated to: David Miller
Headers show
Series [-next] net: wan: sdla: Use bitwise instead of arithmetic | expand

Checks

Context Check Description
jkicinski/cover_letter success Link
jkicinski/fixes_present success Link
jkicinski/patch_count success Link
jkicinski/tree_selection success Guessed tree name to be net-next
jkicinski/subject_prefix warning Target tree name not specified in the subject
jkicinski/source_inline success Was 0 now: 0
jkicinski/verify_signedoff success Link
jkicinski/module_param success Was 0 now: 0
jkicinski/build_32bit fail Errors and warnings before: 5 this patch: 5
jkicinski/kdoc success Errors and warnings before: 0 this patch: 0
jkicinski/verify_fixes success Link
jkicinski/checkpatch fail Link
jkicinski/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
jkicinski/header_inline success Link
jkicinski/stable success Stable not CCed

Commit Message

Samuel Zou Oct. 28, 2020, 8:19 a.m. UTC
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(-)

Comments

Xie He Oct. 30, 2020, 8:58 a.m. UTC | #1
> 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.
diff mbox series

Patch

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;