From: =?unknown-8bit?q?J=CE=B5an?= Sacren <sakiwit@gmail.com>
To: intel-wired-lan@osuosl.org
Subject: [Intel-wired-lan] [next-queue 1/8] e1000: clean up the useless 'continue' statement
Date: Mon, 14 Sep 2015 23:35:01 -0600 [thread overview]
Message-ID: <20150915053501.GA3881@mail.gmail.com> (raw)
In-Reply-To: <32D3D43C-B677-4C70-8915-3B07B1175C66@intel.com>
From: "Rustad, Mark D" <mark.d.rustad@intel.com>
Date: Mon, 14 Sep 2015 16:48:48 +0000
>
> > On Sep 13, 2015, at 11:27 PM, J?an Sacren <sakiwit@gmail.com> wrote:
> >
> > We can delete the 'continue' statement as it is in the end of the block
> > and doesn't do any good. To make it distinctive, put an empty line above
> > the checking block.
> >
> > Additionally add a pair of braces in the 'else' branch.
> >
> > Signed-off-by: Jean Sacren <sakiwit@gmail.com>
> > ---
> > drivers/net/ethernet/intel/e1000/e1000_main.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/e1000/e1000_main.c b/drivers/net/ethernet/intel/e1000/e1000_main.c
> > index 74dc15055971..47397d7b97df 100644
> > --- a/drivers/net/ethernet/intel/e1000/e1000_main.c
> > +++ b/drivers/net/ethernet/intel/e1000/e1000_main.c
> > @@ -1199,12 +1199,13 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> > for (i = 0; i < 32; i++) {
> > hw->phy_addr = i;
> > e1000_read_phy_reg(hw, PHY_ID2, &tmp);
> > +
> > if (tmp == 0 || tmp == 0xFF) {
> > if (i == 31)
> > goto err_eeprom;
> > - continue;
> > - } else
> > + } else {
> > break;
> > + }
> > }
> > }
>
> I think I would prefer leaving the continue, deleting the else and
> undenting the break one level. Since the first portion of the original
> if statement will never "fall through", the else is really the
> redundant part.
Thank you for reviewing.
The goto statement might be executed if and only if at the last loop out
of a total of 32. I think we need to rewrite the checking logic here:
...
if (tmp != 0 && tmp != 0xFF)
break;
if (i == 31)
goto err_eeprom;
...
What do you think?
next prev parent reply other threads:[~2015-09-15 5:35 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-14 6:27 [Intel-wired-lan] [next-queue 0/8] Trivial fix-ups for Intel wired LAN drivers 09/10/2015 =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 1/8] e1000: clean up the useless 'continue' statement =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 16:48 ` Rustad, Mark D
2015-09-15 5:35 ` =?unknown-8bit?q?J=CE=B5an?= Sacren [this message]
2015-09-15 18:24 ` Rustad, Mark D
2015-09-16 15:34 ` =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-16 16:38 ` Alexander Duyck
2015-09-16 18:27 ` Rustad, Mark D
2015-09-16 21:09 ` Alexander Duyck
2015-09-16 23:36 ` Rustad, Mark D
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 2/8] e1000: fix a typo in the comment =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 3/8] e1000e: clean up the local variable =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 4/8] i40e: fix kernel-doc argument name =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-22 21:27 ` Bowers, AndrewX
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 5/8] ixgbe: fix multiple kernel-doc errors =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 6/8] i40e: declare rather than initialize int object =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 7/8] e1000: fix kernel-doc argument being missing =?unknown-8bit?q?J=CE=B5an?= Sacren
2015-09-14 6:27 ` [Intel-wired-lan] [next-queue 8/8] e1000: get rid of duplicate exit path =?unknown-8bit?q?J=CE=B5an?= Sacren
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=20150915053501.GA3881@mail.gmail.com \
--to=sakiwit@gmail.com \
--cc=intel-wired-lan@osuosl.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.