[dpdk-dev,v2,1/2] net/mlx4: fix returned values upon failed probing
Checks
Commit Message
Let error messages in place, but return unambiguous values upon
probing errors.
Fixes: 66e1591687ac ("mlx4: avoid init errors when kernel modules are not loaded")
Cc: stable@dpdk.org
Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
---
drivers/net/mlx4/mlx4.c | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
Comments
On 3/28/2017 3:13 PM, Gaetan Rivet wrote:
> Let error messages in place, but return unambiguous values upon
> probing errors.
>
> Fixes: 66e1591687ac ("mlx4: avoid init errors when kernel modules are not loaded")
> Cc: stable@dpdk.org
>
> Signed-off-by: Gaetan Rivet <gaetan.rivet@6wind.com>
> Acked-by: Adrien Mazarguil <adrien.mazarguil@6wind.com>
Series applied to dpdk-next-net/master, thanks.
(These were included into RC1, patches updated in patchwork, but it
seems missed notifying via e-mail, which is done now)
@@ -5521,10 +5521,8 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
list = ibv_get_device_list(&i);
if (list == NULL) {
assert(errno);
- if (errno == ENOSYS) {
- WARN("cannot list devices, is ib_uverbs loaded?");
- return 0;
- }
+ if (errno == ENOSYS)
+ ERROR("cannot list devices, is ib_uverbs loaded?");
return -errno;
}
assert(i >= 0);
@@ -5556,11 +5554,11 @@ mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
ibv_free_device_list(list);
switch (err) {
case 0:
- WARN("cannot access device, is mlx4_ib loaded?");
- return 0;
+ ERROR("cannot access device, is mlx4_ib loaded?");
+ return -ENODEV;
case EINVAL:
- WARN("cannot use device, are drivers up to date?");
- return 0;
+ ERROR("cannot use device, are drivers up to date?");
+ return -EINVAL;
}
assert(err > 0);
return -err;