* [PATCH] Staging: rtl8723bs: Remove unnecessary static variable initialization
@ 2024-12-16 6:16 Junho Shon
2024-12-16 7:59 ` Przemek Kitszel
0 siblings, 1 reply; 2+ messages in thread
From: Junho Shon @ 2024-12-16 6:16 UTC (permalink / raw)
To: edumazet, davem
Cc: dsahern, kuba, pabeni, horms, netdev, linux-kernel, junoshon
From: junoshon <sanoldfox@naver.com>
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.
Signed-off-by: Junho Shon <sanoldfox@naver.com>
---
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;
+ static int __tcp_tx_delay_enabled;
if (cmpxchg(&__tcp_tx_delay_enabled, 0, 1) == 0) {
static_branch_enable(&tcp_tx_delay_enabled);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Staging: rtl8723bs: Remove unnecessary static variable initialization
2024-12-16 6:16 [PATCH] Staging: rtl8723bs: Remove unnecessary static variable initialization Junho Shon
@ 2024-12-16 7:59 ` Przemek Kitszel
0 siblings, 0 replies; 2+ messages in thread
From: Przemek Kitszel @ 2024-12-16 7:59 UTC (permalink / raw)
To: Junho Shon
Cc: dsahern, kuba, edumazet, pabeni, davem, horms, netdev,
linux-kernel
On 12/16/24 07:16, Junho Shon wrote:
> From: junoshon <sanoldfox@naver.com>
>
> 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@naver.com>
> ---
> 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);
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-12-16 8:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-16 6:16 [PATCH] Staging: rtl8723bs: Remove unnecessary static variable initialization Junho Shon
2024-12-16 7:59 ` Przemek Kitszel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox