[PATCH v4 17/20] net/txgbe: fix get module info operation
Zaiyu Wang
zaiyuwang at trustnetic.com
Wed May 27 13:18:36 CEST 2026
> ## ERRORS
>
> ### 1. Resource leak on error path after lock acquisition
The AI review suggested moving the module presence checks inside the lock, which I believe
is not necessary. The presence checks occur before acquiring the semaphore, so returning
early cannot leak the lock. All error paths after lock acquisition do properly go through
the ERROR_IO label and release the semaphore.
I've changed the pre-lock error from -EIO to - EINVAL to better distinguish "module not
present" from actual I/O failures.
> ---
>
> ## WARNINGS
>
> ### 1. Implicit comparison with zero
Fixed.
> ### 2. Mixed type usage: `u8` vs `uint8_t`
Fixed.
> ### 3. Unnecessary variable initialization
Fixed.
> ## INFO
>
> ### 2. Error message clarity
> The error messages "I2C IO ERROR" and "SFF Module Type not recognized" are
> informative. Consider whether these should include additional context (e.g., the
> identifier value for unrecognized types) to aid debugging.
Added identifier value in error message.
More information about the dev
mailing list