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

Ramon Fried rfried.dev at gmail.com
Thu Jun 10 07:48:47 CEST 2021


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 ?


More information about the U-Boot mailing list