Re: [PATCH] net: pch_gbe: return errors from MIIM accesses
From: Andrew Lunn
Date: Thu Jun 25 2026 - 10:08:11 EST
On Thu, Jun 25, 2026 at 11:05:03AM +0800, Pengpeng Hou wrote:
> pch_gbe_mac_ctrl_miim() polls for the MIIM controller to become ready,
> but returns zero on the initial ready timeout and ignores the completion
> timeout after issuing the operation. MDIO and PHY helpers can then report
> success with zero or stale data.
>
> Make the MIIM helper return an errno and pass read data through an output
> parameter. Propagate the error through the MDIO read path, the probe-time
> PHY discovery path, and the internal PHY register helpers that already
> return an error status.
>
> Signed-off-by: Pengpeng Hou <pengpeng@xxxxxxxxxxx>
Do you have the hardware? This is a complex change to make without
being able to test it.
You need to think about the risks.
On the one side, MII pretty much never fails. It is a big shift
register, which just gets clocked out. So the errors you are trying to
report probably never happen.
On the other side, you are making a big change to the code. How likely
is it, you made an error, and have broken this code?
I personally would never make a change this size unless i could test
it.
Please also take a look at drivers/net/mii.c. Notice that all calls to
mii->mdio_read() assume success. There is no error checking.
Andrew