From: Igor Russkikh <irusskikh@marvell.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>,
Igor Russkikh <Igor.Russkikh@aquantia.com>,
"David S. Miller" <davem@davemloft.net>,
"Dmitry Bezrukov" <Dmitry.Bezrukov@aquantia.com>,
Nikita Danilov <Nikita.Danilov@aquantia.com>,
Andrew Lunn <andrew@lunn.ch>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [EXT] [PATCH net-next] net: aquantia: fix error handling in aq_nic_init
Date: Mon, 28 Oct 2019 10:53:54 +0000 [thread overview]
Message-ID: <ad34c73f-19ee-eb83-221b-cd9fac1d44d5@marvell.com> (raw)
In-Reply-To: <20191028065633.GA2412@embeddedor>
> Fix currenty ignored returned error by properly error checking
> aq_phy_init().
>
> Addresses-Coverity-ID: 1487376 ("Unused value")
> Fixes: dbcd6806af42 ("net: aquantia: add support for Phy access")
> Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
> ---
> drivers/net/ethernet/aquantia/atlantic/aq_nic.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> index 433adc099e44..1914aa0a19d0 100644
> --- a/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> +++ b/drivers/net/ethernet/aquantia/atlantic/aq_nic.c
> @@ -341,7 +341,8 @@ int aq_nic_init(struct aq_nic_s *self)
>
> if (self->aq_nic_cfg.aq_hw_caps->media_type == AQ_HW_MEDIA_TYPE_TP) {
> self->aq_hw->phy_id = HW_ATL_PHY_ID_MAX;
> - err = aq_phy_init(self->aq_hw);
> + if (!aq_phy_init(self->aq_hw))
> + goto err_exit;
> }
>
> for (i = 0U, aq_vec = self->aq_vec[0];
>
Hi Gustavo,
I'd say the intention here was to ignore the error, as driver may still live if
something unexpected happened on Phy access path.
Notice in the above fix you leave `err` as zero but do error path return -
that'll break the datapath.
I'd prefer to fix this with simple
(void)aq_phy_init(self->aq_hw);
--
Regards,
Igor
next prev parent reply other threads:[~2019-10-28 10:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-28 6:56 [PATCH net-next] net: aquantia: fix error handling in aq_nic_init Gustavo A. R. Silva
2019-10-28 10:53 ` Igor Russkikh [this message]
2019-10-28 12:00 ` [EXT] " Gustavo A. R. Silva
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ad34c73f-19ee-eb83-221b-cd9fac1d44d5@marvell.com \
--to=irusskikh@marvell.com \
--cc=Dmitry.Bezrukov@aquantia.com \
--cc=Igor.Russkikh@aquantia.com \
--cc=Nikita.Danilov@aquantia.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).