[PATCH] net: e1000: Fix Unchecked return value coverity

Z.Q. Hou zhiqiang.hou at nxp.com
Fri Jun 11 04:56:18 CEST 2021



> -----Original Message-----
> From: Ramon Fried <rfried.dev at gmail.com>
> Sent: 2021年6月10日 13:49
> To: Z.Q. Hou <zhiqiang.hou at nxp.com>
> Cc: Joe Hershberger <joe.hershberger at ni.com>; U-Boot Mailing List
> <u-boot at lists.denx.de>
> Subject: Re: [PATCH] net: e1000: Fix Unchecked return value coverity
> 
> On Mon, May 31, 2021 at 6:12 PM Zhiqiang Hou <Zhiqiang.Hou at nxp.com>
> wrote:
> >
> > From: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> >
> > Added check for return value of e1000_read_phy_reg().
> >
> > Signed-off-by: Hou Zhiqiang <Zhiqiang.Hou at nxp.com>
> > ---
> >  drivers/net/e1000.c | 12 ++++++++----
> >  1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/e1000.c b/drivers/net/e1000.c index
> > 694114eca7..1f0d559415 100644
> > --- a/drivers/net/e1000.c
> > +++ b/drivers/net/e1000.c
> > @@ -4738,12 +4738,16 @@ e1000_phy_init_script(struct e1000_hw *hw)
> >                         uint16_t fused, fine, coarse;
> >
> >                         /* Move to analog registers page */
> > -                       e1000_read_phy_reg(hw,
> > -
> IGP01E1000_ANALOG_SPARE_FUSE_STATUS, &fused);
> > +                       if (e1000_read_phy_reg(hw,
> > +
> IGP01E1000_ANALOG_SPARE_FUSE_STATUS,
> > +                                              &fused))
> > +                               return;
> >
> >                         if (!(fused &
> IGP01E1000_ANALOG_SPARE_FUSE_ENABLED)) {
> > -                               e1000_read_phy_reg(hw,
> > -
> IGP01E1000_ANALOG_FUSE_STATUS, &fused);
> > +                               if (e1000_read_phy_reg(hw,
> > +
> IGP01E1000_ANALOG_FUSE_STATUS,
> > +
> &fused))
> > +                                       return;
> >
> >                                 fine = fused &
> IGP01E1000_ANALOG_FUSE_FINE_MASK;
> >                                 coarse = fused
> > --
> > 2.17.1
> >
> What about some error messages ?

CID 43664 (#15 of 15): Unchecked return value (CHECKED_RETURN)
6. check_return: Calling e1000_read_phy_reg without checking return value (as is done elsewhere 44 out of 47 times).

- Zhiqiang


More information about the U-Boot mailing list