Disclaimer: This report was prepared with AI assistance (Claude Code). I reviewed it, verified the code citations against master myself, and validated the behaviour on real hardware where noted before filing.
Line numbers vs drivers/net/w5500.c at master 50f91ef502.
1. NETDEV_RXERRORS(&priv->dev) references variables that do not exist
l. 1351, in w5500_receive():
NETDEV_RXERRORS(&priv->dev);
Neither priv nor a field named dev exists in this function — the
variable is self and the field is w_dev. This compiles today only
because NETDEV_RXERRORS() expands to nothing without
CONFIG_NETDEV_STATISTICS; enabling statistics breaks the build.
Fix: NETDEV_RXERRORS(&self->w_dev);
2. d_private set to the device array instead of the instance
l. 2069, in w5500_initialize():
self->w_dev.d_private = g_w5500; /* Used to recover private state from dev */
Should be self. Harmless for device 0 (g_w5500 == &g_w5500[0]), 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;
Both fixes are included in the reference branch:
https://github.com/ricardgb/nuttx/tree/w5500-driver-fixes
Disclosure: found during an AI-assisted (Claude Code) audit, verified by
me by reading the cited lines against master.
Line numbers vs
drivers/net/w5500.cat master50f91ef502.1.
NETDEV_RXERRORS(&priv->dev)references variables that do not existl. 1351, in
w5500_receive():Neither
privnor a field nameddevexists in this function — thevariable is
selfand the field isw_dev. This compiles today onlybecause
NETDEV_RXERRORS()expands to nothing withoutCONFIG_NETDEV_STATISTICS; enabling statistics breaks the build.Fix:
NETDEV_RXERRORS(&self->w_dev);2.
d_privateset to the device array instead of the instancel. 2069, in
w5500_initialize():Should be
self. Harmless for device 0 (g_w5500 == &g_w5500[0]), wrongfor any
devno > 0— every callback that recovers the driver state viadev->d_privatewould operate on device 0's state.Fix:
self->w_dev.d_private = self;Both fixes are included in the reference branch:
https://github.com/ricardgb/nuttx/tree/w5500-driver-fixesDisclosure: found during an AI-assisted (Claude Code) audit, verified by
me by reading the cited lines against master.