ec: Fix array access past end of array
ec: Fix array access past end of array

The test usb_common::test_pd_set_vbus_discharge_wrong_args exposed an
array access past the end of the array.

Move the port check to before the inited[] access.

BRANCH=None
BUG=None
TEST=Tested on gitlab-runner

Signed-off-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@google.com>
Change-Id: I47dcf64ec6caabd263ef146939bbc3f10e444ea7
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3995820
Reviewed-by: Abe Levkoy <2e1ad7039298f93262cf06bbb457275fb3e2ecb5@chromium.org>
Auto-Submit: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>
Commit-Queue: Abe Levkoy <2e1ad7039298f93262cf06bbb457275fb3e2ecb5@chromium.org>
Code-Coverage: Zoss <345cf107e82c70959d46f59d98bddc98ce458aff@prod.google.com>
Tested-by: Jeremy Bettis <4df7b5147fee087dca33c181f288ee7dbf56e022@chromium.org>

coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec,coreboot/chrome-ec