Re: [PATCH] Staging: rtl8723bs: Remove unnecessary static variable initialization

From: Przemek Kitszel
Date: Mon Dec 16 2024 - 03:04:37 EST


On 12/16/24 07:16, Junho Shon wrote:
From: junoshon <sanoldfox@xxxxxxxxx>

Fixed a coding style issue where the static variable '__tcp_tx_delay_enabled'
was explicitly initialized to 0. Static variables are automatically zero-initialized
by the compiler, so the explicit initialization is redundant.

Please don't post patches with the sole purpose of fixing minor style
issues. Also, the Subject line has wrong prefix.

Removing initialization of stack variables that will be assigned
unconditionally is of course a different kind of fix, still welcomed.


Signed-off-by: Junho Shon <sanoldfox@xxxxxxxxx>
---
net/ipv4/tcp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
index 0d704bda6..b67887a69 100644
--- a/net/ipv4/tcp.c
+++ b/net/ipv4/tcp.c
@@ -3498,7 +3498,7 @@ EXPORT_SYMBOL(tcp_tx_delay_enabled);
static void tcp_enable_tx_delay(void)
{
if (!static_branch_unlikely(&tcp_tx_delay_enabled)) {
- static int __tcp_tx_delay_enabled = 0;

Even if not needed, it improves readability a bit.

+ static int __tcp_tx_delay_enabled;
if (cmpxchg(&__tcp_tx_delay_enabled, 0, 1) == 0) {
static_branch_enable(&tcp_tx_delay_enabled);