[dpdk-dev,1/2] net/mlx4: fix returned values upon failed probing

Message ID 2f6db539fb06934a9433fea1e3ea64d5171db962.1490624067.git.gaetan.rivet@6wind.com (mailing list archive)
State Changes Requested, archived
Delegated to: Ferruh Yigit
Headers

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/Intel-compilation success Compilation OK

Commit Message

Gaëtan Rivet March 27, 2017, 2:17 p.m. UTC
  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

Ferruh Yigit March 28, 2017, 10:15 a.m. UTC | #1
On 3/27/2017 3:17 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>

Hi Gaetan,

I am getting merge conflict in this patch, can you please rebase it on
top of latest next-net?

Thanks,
ferruh
  
Gaëtan Rivet March 28, 2017, 2:14 p.m. UTC | #2
Hi Ferruh,

On Tue, Mar 28, 2017 at 11:15:42AM +0100, Ferruh Yigit wrote:
>On 3/27/2017 3:17 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>
>
>Hi Gaetan,
>
>I am getting merge conflict in this patch, can you please rebase it on
>top of latest next-net?
>

Here: http://dpdk.org/ml/archives/dev/2017-March/061871.html

>Thanks,
>ferruh
>
>
  

Patch

diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 665d8f7..24166c9 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -5706,10 +5706,8 @@  mlx4_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev)
 	list = ibv_exp_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);
@@ -5741,11 +5739,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;