drivers/net/w5500: fix wrong variable names in receive error path and d_private assignment#19397
Closed
Zepp-Hanzj wants to merge 1 commit into
Closed
drivers/net/w5500: fix wrong variable names in receive error path and d_private assignment#19397Zepp-Hanzj wants to merge 1 commit into
Zepp-Hanzj wants to merge 1 commit into
Conversation
xiaoxiang781216
previously approved these changes
Jul 11, 2026
Contributor
|
@Zepp-Hanzj please fix ci warning: |
Fix two latent defects in the W5500 Ethernet driver: 1. In w5500_receive(), NETDEV_RXERRORS() referenced &priv->dev but the function parameter is named 'self' and the device field is 'w_dev'. This compiles only because NETDEV_RXERRORS() expands to nothing without CONFIG_NETDEV_STATISTICS; enabling statistics breaks the build. Fix: NETDEV_RXERRORS(&self->w_dev). 2. In w5500_initialize(), d_private was set to g_w5500 (the global array) instead of self (the current instance). This is harmless for device 0 (g_w5500 == &g_w5500[0]) but wrong for any devno > 0 -- every callback that recovers the driver state via dev->d_private would operate on device 0's state. Fix: self->w_dev.d_private = self. Fixes apache#19306 Signed-off-by: hanzhijian <hanzhijian@zepp.com> Author: hanzhijian <hanzhijian@zepp.com>
9a0fdb1 to
e70ff8e
Compare
Contributor
Author
|
Closing: needs real hardware verification before submission. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fix two latent defects in the W5500 Ethernet driver:
NETDEV_RXERRORS()references non-existent variables (line 1351): Inw5500_receive(), the error path uses&priv->devbut the function parameter is namedselfand the device field isw_dev. This compiles only becauseNETDEV_RXERRORS()expands to nothing withoutCONFIG_NETDEV_STATISTICS; enabling statistics breaks the build.d_privateset to the device array instead of the instance (line 2069): Inw5500_initialize(),d_privatewas set tog_w5500(the global array) instead ofself(the current instance). This is harmless for device 0 (g_w5500 == &g_w5500[0]) but wrong for anydevno > 0— every callback that recovers the driver state viadev->d_privatewould operate on device 0's state.Fixes #19306
Impact
devno > 0CONFIG_NETDEV_STATISTICSenabledTesting
Signed-off-by: hanzhijian hanzhijian@zepp.com