Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1186200 > unrolled thread
| Started by | Michael Chan <mchan@broadcom.com> |
|---|---|
| First post | 2015-07-16 21:20 +0200 |
| Last post | 2015-07-16 21:30 +0200 |
| Articles | 2 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: [PATCH] tg3:Add error handling to the function tg3_test_loopback Michael Chan <mchan@broadcom.com> - 2015-07-16 21:20 +0200
Re: [PATCH] tg3:Add error handling to the function tg3_test_loopback Michael Chan <mchan@broadcom.com> - 2015-07-16 21:30 +0200
| From | Michael Chan <mchan@broadcom.com> |
|---|---|
| Date | 2015-07-16 21:20 +0200 |
| Subject | Re: [PATCH] tg3:Add error handling to the function tg3_test_loopback |
| Message-ID | <pMWRk-7rm-25@gated-at.bofh.it> |
On Thu, 2015-07-16 at 14:51 -0400, Nicholas Krause wrote:
> This adds proper error handling for if the calls to the function
> tg3_phy_lpbk_set fail by returning -EIO by assigning the return
> value to the variable err and if it equals anything other then
> zero jumps to the goto label done as no other work can be handled
> internally in the function tg3_test_loopback.
>
> Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
Acked-by: Michael Chan <mchan@broadcom.com>
> ---
> drivers/net/ethernet/broadcom/tg3.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> index 73c934c..8584cb7 100644
> --- a/drivers/net/ethernet/broadcom/tg3.c
> +++ b/drivers/net/ethernet/broadcom/tg3.c
> @@ -13625,8 +13625,10 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
> !tg3_flag(tp, USE_PHYLIB)) {
> int i;
>
> - tg3_phy_lpbk_set(tp, 0, false);
> -
> + err = tg3_phy_lpbk_set(tp, 0, false);
> + if (err)
> + goto done;
> +
> /* Wait for link */
> for (i = 0; i < 100; i++) {
> if (tr32(MAC_TX_STATUS) & TX_STATUS_LINK_UP)
> @@ -13644,8 +13646,10 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
> data[TG3_PHY_LOOPB_TEST] |= TG3_JMB_LOOPBACK_FAILED;
>
> if (do_extlpbk) {
> - tg3_phy_lpbk_set(tp, 0, true);
> -
> + err = tg3_phy_lpbk_set(tp, 0, true);
> +
> + if (err)
> + goto done;
> /* All link indications report up, but the hardware
> * isn't really ready for about 20 msec. Double it
> * to be sure.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Michael Chan <mchan@broadcom.com> |
|---|---|
| Date | 2015-07-16 21:30 +0200 |
| Message-ID | <pMX10-7CX-23@gated-at.bofh.it> |
| In reply to | #1186200 |
On Thu, 2015-07-16 at 12:18 -0700, Michael Chan wrote:
> On Thu, 2015-07-16 at 14:51 -0400, Nicholas Krause wrote:
> > This adds proper error handling for if the calls to the function
> > tg3_phy_lpbk_set fail by returning -EIO by assigning the return
> > value to the variable err and if it equals anything other then
> > zero jumps to the goto label done as no other work can be handled
> > internally in the function tg3_test_loopback.
> >
> > Signed-off-by: Nicholas Krause <xerofoify@gmail.com>
>
> Acked-by: Michael Chan <mchan@broadcom.com>
Your indentation doesn't look right. Other than that, it is ok.
>
> > ---
> > drivers/net/ethernet/broadcom/tg3.c | 12 ++++++++----
> > 1 file changed, 8 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
> > index 73c934c..8584cb7 100644
> > --- a/drivers/net/ethernet/broadcom/tg3.c
> > +++ b/drivers/net/ethernet/broadcom/tg3.c
> > @@ -13625,8 +13625,10 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
> > !tg3_flag(tp, USE_PHYLIB)) {
> > int i;
> >
> > - tg3_phy_lpbk_set(tp, 0, false);
> > -
> > + err = tg3_phy_lpbk_set(tp, 0, false);
> > + if (err)
> > + goto done;
> > +
> > /* Wait for link */
> > for (i = 0; i < 100; i++) {
> > if (tr32(MAC_TX_STATUS) & TX_STATUS_LINK_UP)
> > @@ -13644,8 +13646,10 @@ static int tg3_test_loopback(struct tg3 *tp, u64 *data, bool do_extlpbk)
> > data[TG3_PHY_LOOPB_TEST] |= TG3_JMB_LOOPBACK_FAILED;
> >
> > if (do_extlpbk) {
> > - tg3_phy_lpbk_set(tp, 0, true);
> > -
> > + err = tg3_phy_lpbk_set(tp, 0, true);
> > +
> > + if (err)
> > + goto done;
> > /* All link indications report up, but the hardware
> > * isn't really ready for about 20 msec. Double it
> > * to be sure.
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web