From: Fan Zhang Date: Wed, 11 Jan 2017 14:09:47 +0000 (+0000) Subject: cryptodev: fix loop in device query X-Git-Tag: spdx-start~4704 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c5b70818adf02f97f049c2b2b3206e89d6f6c64b;p=dpdk.git cryptodev: fix loop in device query This patch fixes the dev value update problem in rte_cryptodev_pmd_get_named_dev, orginally, dev won't be updated after the initial step in the loop. Fixes: d11b0f30df88 ("cryptodev: introduce API and framework for crypto devices") Signed-off-by: Fan Zhang Acked-by: Fiona Trahe --- diff --git a/lib/librte_cryptodev/rte_cryptodev_pmd.h b/lib/librte_cryptodev/rte_cryptodev_pmd.h index abfe2dc11f..c6a57945bb 100644 --- a/lib/librte_cryptodev/rte_cryptodev_pmd.h +++ b/lib/librte_cryptodev/rte_cryptodev_pmd.h @@ -183,8 +183,9 @@ rte_cryptodev_pmd_get_named_dev(const char *name) if (name == NULL) return NULL; - for (i = 0, dev = &rte_cryptodev_globals->devs[i]; - i < rte_cryptodev_globals->max_devs; i++) { + for (i = 0; i < rte_cryptodev_globals->max_devs; i++) { + dev = &rte_cryptodev_globals->devs[i]; + if ((dev->attached == RTE_CRYPTODEV_ATTACHED) && (strcmp(dev->data->name, name) == 0)) return dev;