diff mbox series

net: ethernet: miss media cleanup behavior

Message ID 20241106141152.1943-1-liangwentao@iscas.ac.cn (mailing list archive)
State Changes Requested
Delegated to: Netdev Maintainers
Headers show
Series net: ethernet: miss media cleanup behavior | 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: 3 this patch: 3
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers warning 5 maintainers not CCed: linux-parisc@vger.kernel.org andrew+netdev@lunn.ch pabeni@redhat.com edumazet@google.com kuba@kernel.org
netdev/build_clang success Errors and warnings before: 3 this patch: 3
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: 4 this patch: 4
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 15 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 success net-next-2024-11-06--18-00 (tests: 782)

Commit Message

Wentao Liang Nov. 6, 2024, 2:11 p.m. UTC
In the de21041_media_timer(), line 1081, when media type is locked,
the code jumps to line 1136 to perform cleanup operations. However,
in the de21040_media_timer(), line 991, the same condition leads to
an immediate return without any cleanup.

To address this inconsistency, we have added a jump statement to the
de21040_media_timer() to ensure that cleanup operations are executed
before the function returns.

Signed-off-by: Wentao Liang <liangwentao@iscas.ac.cn>
---
 drivers/net/ethernet/dec/tulip/de2104x.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Jiri Pirko Nov. 6, 2024, 3:20 p.m. UTC | #1
Wed, Nov 06, 2024 at 03:11:52PM CET, liangwentao@iscas.ac.cn wrote:
>In the de21041_media_timer(), line 1081, when media type is locked,
>the code jumps to line 1136 to perform cleanup operations. However,
>in the de21040_media_timer(), line 991, the same condition leads to
>an immediate return without any cleanup.

Don't use line numbers please.


>
>To address this inconsistency, we have added a jump statement to the

Who's "we"? Just tell the codebase what to do, what to add, what to
change, etc.


>de21040_media_timer() to ensure that cleanup operations are executed
>before the function returns.
>
>Signed-off-by: Wentao Liang <liangwentao@iscas.ac.cn>

You are missing "Fixes" tag blaming the commit that introduced the
issue.


Actually, just to make things in the same way de21041_media_timer() has
it is not a good reason to do so. What are you trying to fix? What issue
you see. Why the code change is ok?

The code itself looks okay to me.


>---
> drivers/net/ethernet/dec/tulip/de2104x.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
>index 0a161a4db242..724c0b3b3966 100644
>--- a/drivers/net/ethernet/dec/tulip/de2104x.c
>+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
>@@ -988,7 +988,7 @@ static void de21040_media_timer (struct timer_list *t)
> 	de_link_down(de);
> 
> 	if (de->media_lock)
>-		return;
>+		goto set_media;
> 
> 	if (de->media_type == DE_MEDIA_AUI) {
> 		static const u32 next_state = DE_MEDIA_TP;
>@@ -998,6 +998,7 @@ static void de21040_media_timer (struct timer_list *t)
> 		de_next_media(de, &next_state, 1);
> 	}
> 
>+set_media:
> 	spin_lock_irqsave(&de->lock, flags);
> 	de_stop_rxtx(de);
> 	spin_unlock_irqrestore(&de->lock, flags);
>-- 
>2.42.0.windows.2
>
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/dec/tulip/de2104x.c b/drivers/net/ethernet/dec/tulip/de2104x.c
index 0a161a4db242..724c0b3b3966 100644
--- a/drivers/net/ethernet/dec/tulip/de2104x.c
+++ b/drivers/net/ethernet/dec/tulip/de2104x.c
@@ -988,7 +988,7 @@  static void de21040_media_timer (struct timer_list *t)
 	de_link_down(de);
 
 	if (de->media_lock)
-		return;
+		goto set_media;
 
 	if (de->media_type == DE_MEDIA_AUI) {
 		static const u32 next_state = DE_MEDIA_TP;
@@ -998,6 +998,7 @@  static void de21040_media_timer (struct timer_list *t)
 		de_next_media(de, &next_state, 1);
 	}
 
+set_media:
 	spin_lock_irqsave(&de->lock, flags);
 	de_stop_rxtx(de);
 	spin_unlock_irqrestore(&de->lock, flags);