2020-05-07 06:35:37

by Zou Wei

[permalink] [raw]
Subject: [PATCH -next] ASoC: amd: acp3x-pcm-dma: Use bitwise instead of arithmetic operator for flags

Fix the following coccinelle warnings:

sound/soc/amd/raven/acp3x-pcm-dma.c:161:39-40: WARNING: sum of probable bitmasks, consider |
sound/soc/amd/raven/acp3x-pcm-dma.c:172:39-40: WARNING: sum of probable bitmasks, consider |
sound/soc/amd/raven/acp3x-pcm-dma.c:183:39-40: WARNING: sum of probable bitmasks, consider |
sound/soc/amd/raven/acp3x-pcm-dma.c:194:39-40: WARNING: sum of probable bitmasks, consider |

Reported-by: Hulk Robot <[email protected]>
Signed-off-by: Samuel Zou <[email protected]>
---
sound/soc/amd/raven/acp3x-pcm-dma.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
index e362f0b..b0cc0fe 100644
--- a/sound/soc/amd/raven/acp3x-pcm-dma.c
+++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
@@ -158,7 +158,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_dma_size = mmACP_BT_TX_DMA_SIZE;
- acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
+ acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
BT_PB_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_BT_TX_FIFOADDR;
reg_fifo_size = mmACP_BT_TX_FIFOSIZE;
@@ -169,7 +169,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
case I2S_SP_INSTANCE:
default:
reg_dma_size = mmACP_I2S_TX_DMA_SIZE;
- acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
+ acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
SP_PB_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_I2S_TX_FIFOADDR;
reg_fifo_size = mmACP_I2S_TX_FIFOSIZE;
@@ -180,7 +180,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
switch (rtd->i2s_instance) {
case I2S_BT_INSTANCE:
reg_dma_size = mmACP_BT_RX_DMA_SIZE;
- acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
+ acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
BT_CAPT_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_BT_RX_FIFOADDR;
reg_fifo_size = mmACP_BT_RX_FIFOSIZE;
@@ -191,7 +191,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
case I2S_SP_INSTANCE:
default:
reg_dma_size = mmACP_I2S_RX_DMA_SIZE;
- acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
+ acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
SP_CAPT_FIFO_ADDR_OFFSET;
reg_fifo_addr = mmACP_I2S_RX_FIFOADDR;
reg_fifo_size = mmACP_I2S_RX_FIFOSIZE;
--
2.6.2


2020-05-07 06:46:12

by Joe Perches

[permalink] [raw]
Subject: Re: [PATCH -next] ASoC: amd: acp3x-pcm-dma: Use bitwise instead of arithmetic operator for flags

On Thu, 2020-05-07 at 14:39 +0800, Samuel Zou wrote:
> Fix the following coccinelle warnings:

> sound/soc/amd/raven/acp3x-pcm-dma.c:161:39-40: WARNING: sum of probable bitmasks, consider |
> sound/soc/amd/raven/acp3x-pcm-dma.c:172:39-40: WARNING: sum of probable bitmasks, consider |
> sound/soc/amd/raven/acp3x-pcm-dma.c:183:39-40: WARNING: sum of probable bitmasks, consider |
> sound/soc/amd/raven/acp3x-pcm-dma.c:194:39-40: WARNING: sum of probable bitmasks, consider |

These are not bitmasks.

Samuel, please look deeper at the code before submitting
bad patches.

And hey Julia.

This is the second false positive submitted for this
warning today.

Can you please remove the script or fix it so it
uses better logic?k

Thanks.


> Reported-by: Hulk Robot <[email protected]>
> Signed-off-by: Samuel Zou <[email protected]>
> ---
> sound/soc/amd/raven/acp3x-pcm-dma.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c
> index e362f0b..b0cc0fe 100644
> --- a/sound/soc/amd/raven/acp3x-pcm-dma.c
> +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c
> @@ -158,7 +158,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
> switch (rtd->i2s_instance) {
> case I2S_BT_INSTANCE:
> reg_dma_size = mmACP_BT_TX_DMA_SIZE;
> - acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
> + acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
> BT_PB_FIFO_ADDR_OFFSET;
> reg_fifo_addr = mmACP_BT_TX_FIFOADDR;
> reg_fifo_size = mmACP_BT_TX_FIFOSIZE;
> @@ -169,7 +169,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
> case I2S_SP_INSTANCE:
> default:
> reg_dma_size = mmACP_I2S_TX_DMA_SIZE;
> - acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
> + acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
> SP_PB_FIFO_ADDR_OFFSET;
> reg_fifo_addr = mmACP_I2S_TX_FIFOADDR;
> reg_fifo_size = mmACP_I2S_TX_FIFOSIZE;
> @@ -180,7 +180,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
> switch (rtd->i2s_instance) {
> case I2S_BT_INSTANCE:
> reg_dma_size = mmACP_BT_RX_DMA_SIZE;
> - acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
> + acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
> BT_CAPT_FIFO_ADDR_OFFSET;
> reg_fifo_addr = mmACP_BT_RX_FIFOADDR;
> reg_fifo_size = mmACP_BT_RX_FIFOSIZE;
> @@ -191,7 +191,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction)
> case I2S_SP_INSTANCE:
> default:
> reg_dma_size = mmACP_I2S_RX_DMA_SIZE;
> - acp_fifo_addr = ACP_SRAM_PTE_OFFSET +
> + acp_fifo_addr = ACP_SRAM_PTE_OFFSET |
> SP_CAPT_FIFO_ADDR_OFFSET;
> reg_fifo_addr = mmACP_I2S_RX_FIFOADDR;
> reg_fifo_size = mmACP_I2S_RX_FIFOSIZE;