check_ethernet: perform ping check more selectively

We only intend to do this check

(a) initially; to see whether we need to do any recovery at all and
(b) after a recovery_method claims to have performed an action

For (b), this comes when the recovery_method returns 0 (success), and so
we move on to the latter phase of the loop.

Therefore, (a) can be moved outside the loop, saving time.

BUG=none
TEST=manual tests

Change-Id: I7f7ad380abca4675fc46bef4d125235c8f63dfa4
Reviewed-on: https://chromium-review.googlesource.com/1714127
Tested-by: Brian Norris <briannorris@chromium.org>
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Legacy-Commit-Queue: Commit Bot <commit-bot@chromium.org>
Reviewed-by: Grant Grundler <grundler@chromium.org>
1 file changed