usb_pd_policy: check if the pointer is NULL or not
usb_pd_policy: check if the pointer is NULL or not

  Memset() initialize structure pointer fx member point to
code address 0 in pd_dfp_pe_init(). When we receive ack of
discover mode, we will input svid 0 to pd_dfp_enter_mode(),
and if the value of code address 0 and 1 is also same as 0x0000.
It means that we will get the both match mode index value 0
in allocate_mode(), but now the pe[].amodes[].fx point to
NULL, and later executing enter VDM mode results in EC reset.
So in order to get the right mode index, we need check if
the pointer is NULL or not when we compare with SVID in
get_mode_idx().

BUG=none
BRANCH=none
TEST=check logs via UART and Lecroy on reef_it8320, ampton,
     PD EVB with risc-v core:
     1.connect to adapter: state to SNK_READY
     2.connect to dongle: state to SRC_READY, and done VDM
       enumeration.

Change-Id: I709efc71f4e64540f1526967dca41e8c2bf34a02
Signed-off-by: Ruibin Chang <6748d95250dd3d29f04d200035d5434f3b7820ef@ite.com.tw>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1966822
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>

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