diff mbox series

[next] net: ipa: remove the redundant assignment to variable trans_id

Message ID 20240116114025.2264839-1-colin.i.king@gmail.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [next] net: ipa: remove the redundant assignment to variable trans_id | expand

Checks

Context Check Description
netdev/series_format warning Single patches do not need cover letters; Target tree name not specified in the subject
netdev/tree_selection success Guessed tree name to be net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 1092 this patch: 1092
netdev/cc_maintainers success CCed 0 of 0 maintainers
netdev/build_clang success Errors and warnings before: 1107 this patch: 1107
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 1107 this patch: 1107
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest pending net-next-2024-01-16--18-00

Commit Message

Colin Ian King Jan. 16, 2024, 11:40 a.m. UTC
The variable trans_id is being modulo'd by channel->tre_count and
the value is being re-assigned back to trans_id even though the
variable is not used after this operation. The assignment is
redundant. Remove the assignment and just replace it with the modulo
operator.

Cleans up clang scan build warning:
warning: Although the value stored to 'trans_id' is used in the
enclosing expression, the value is never actually read from
'trans_id' [deadcode.DeadStores]

Signed-off-by: Colin Ian King <colin.i.king@gmail.com>
---
 drivers/net/ipa/gsi_trans.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alex Elder Jan. 16, 2024, 11:44 a.m. UTC | #1
On 1/16/24 5:40 AM, Colin Ian King wrote:
> The variable trans_id is being modulo'd by channel->tre_count and
> the value is being re-assigned back to trans_id even though the
> variable is not used after this operation. The assignment is
> redundant. Remove the assignment and just replace it with the modulo
> operator.
> 
> Cleans up clang scan build warning:
> warning: Although the value stored to 'trans_id' is used in the
> enclosing expression, the value is never actually read from
> 'trans_id' [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

This looks good.  I saw this before but hadn't gotten around to
fixing it yet.  Thank you!

Reviewed-by: Alex Elder <elder@linaro.org>

> ---
>   drivers/net/ipa/gsi_trans.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
> index ee6fb00b71eb..f5dafc2f53ab 100644
> --- a/drivers/net/ipa/gsi_trans.c
> +++ b/drivers/net/ipa/gsi_trans.c
> @@ -247,7 +247,7 @@ struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
>   			return NULL;
>   	}
>   
> -	return &trans_info->trans[trans_id %= channel->tre_count];
> +	return &trans_info->trans[trans_id % channel->tre_count];
>   }
>   
>   /* Move a transaction from allocated to committed state */
Simon Horman Jan. 16, 2024, 7:31 p.m. UTC | #2
On Tue, Jan 16, 2024 at 11:40:25AM +0000, Colin Ian King wrote:
> The variable trans_id is being modulo'd by channel->tre_count and
> the value is being re-assigned back to trans_id even though the
> variable is not used after this operation. The assignment is
> redundant. Remove the assignment and just replace it with the modulo
> operator.
> 
> Cleans up clang scan build warning:
> warning: Although the value stored to 'trans_id' is used in the
> enclosing expression, the value is never actually read from
> 'trans_id' [deadcode.DeadStores]
> 
> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

## Form letter - net-next-closed

[adapted from text by Jakub]

Hi Colin,

The merge window for v6.8 has begun and therefore net-next is closed
for new drivers, features, code refactoring and optimizations.
We are currently accepting bug fixes only.

Please repost when net-next reopens on or after 22nd January.

RFC patches sent for review only are obviously welcome at any time.

See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
--
pw-bot: defer
Alex Elder Jan. 26, 2024, 3:15 p.m. UTC | #3
On 1/16/24 1:31 PM, Simon Horman wrote:
> On Tue, Jan 16, 2024 at 11:40:25AM +0000, Colin Ian King wrote:
>> The variable trans_id is being modulo'd by channel->tre_count and
>> the value is being re-assigned back to trans_id even though the
>> variable is not used after this operation. The assignment is
>> redundant. Remove the assignment and just replace it with the modulo
>> operator.
>>
>> Cleans up clang scan build warning:
>> warning: Although the value stored to 'trans_id' is used in the
>> enclosing expression, the value is never actually read from
>> 'trans_id' [deadcode.DeadStores]
>>
>> Signed-off-by: Colin Ian King <colin.i.king@gmail.com>

Colin, net-next is open now and you are welcome to send v2 of
this patch.
     https://netdev.bots.linux.dev/net-next.html

					-Alex

> 
> ## Form letter - net-next-closed
> 
> [adapted from text by Jakub]
> 
> Hi Colin,
> 
> The merge window for v6.8 has begun and therefore net-next is closed
> for new drivers, features, code refactoring and optimizations.
> We are currently accepting bug fixes only.
> 
> Please repost when net-next reopens on or after 22nd January.
> 
> RFC patches sent for review only are obviously welcome at any time.
> 
> See: https://www.kernel.org/doc/html/next/process/maintainer-netdev.html#development-cycle
> --
> pw-bot: defer
diff mbox series

Patch

diff --git a/drivers/net/ipa/gsi_trans.c b/drivers/net/ipa/gsi_trans.c
index ee6fb00b71eb..f5dafc2f53ab 100644
--- a/drivers/net/ipa/gsi_trans.c
+++ b/drivers/net/ipa/gsi_trans.c
@@ -247,7 +247,7 @@  struct gsi_trans *gsi_channel_trans_complete(struct gsi_channel *channel)
 			return NULL;
 	}
 
-	return &trans_info->trans[trans_id %= channel->tre_count];
+	return &trans_info->trans[trans_id % channel->tre_count];
 }
 
 /* Move a transaction from allocated to committed state */