ethdev: fix port lookup if none
authorAnatoly Burakov <anatoly.burakov@intel.com>
Sat, 19 Nov 2016 13:10:11 +0000 (13:10 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 7 Dec 2016 18:04:41 +0000 (19:04 +0100)
commitf9ae888b1e19face2ce02e92936f793499c11956
treeb402e2876c841f65714fba384ffc5abd09554d2f
parent51c0c01b70294cc75250cc28619c9a19ca5579f7
ethdev: fix port lookup if none

Aside from avoiding doing useless work, this also fixes a segfault
when calling rte_eth_dev_get_port_by_name() whenever no devices
were found yet, and therefore rte_eth_dev_data wasn't yet allocated.

Fixes: 9c5b8d8b9feb ("ethdev: clean port id retrieval when attaching")

Signed-off-by: Anatoly Burakov <anatoly.burakov@intel.com>
Acked-by: Thomas Monjalon <thomas.monjalon@6wind.com>
lib/librte_ether/rte_ethdev.c