[2/2] eal: DPDK init doesn't fail even if device probe fails.
Checks
Commit Message
rte_bus_probe() doesn't return error. As a result rte_eal_init()
doesn't catch this error and thus making dpdk initialization
successful despite probe failing for devices.
This patch returns error if probe fails for any of device.
Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
---
lib/librte_eal/common/eal_common_bus.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
Comments
Nitin Katiyar <nitin.katiyar@ericsson.com> writes:
> rte_bus_probe() doesn't return error. As a result rte_eal_init()
> doesn't catch this error and thus making dpdk initialization
> successful despite probe failing for devices.
>
> This patch returns error if probe fails for any of device.
>
> Signed-off-by: Nitin Katiyar <nitin.katiyar@ericsson.com>
> ---
> lib/librte_eal/common/eal_common_bus.c | 8 ++++++--
> 1 file changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/lib/librte_eal/common/eal_common_bus.c b/lib/librte_eal/common/eal_common_bus.c
> index baa5b53..1721179 100644
> --- a/lib/librte_eal/common/eal_common_bus.c
> +++ b/lib/librte_eal/common/eal_common_bus.c
> @@ -70,16 +70,20 @@
> }
>
> ret = bus->probe();
> - if (ret)
> + if (ret) {
> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
> bus->name);
> + return ret;
> + }
If we return an error here, won't this fail to probe vbus? In fact,
this will disrupt all subsequent bus probes, yes?
Why should a single bus problem be a 'cannot init' level failure?
> }
>
> if (vbus) {
> ret = vbus->probe();
> - if (ret)
> + if (ret) {
> RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
> vbus->name);
> + return ret;
> + }
> }
>
> return 0;
@@ -70,16 +70,20 @@
}
ret = bus->probe();
- if (ret)
+ if (ret) {
RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
bus->name);
+ return ret;
+ }
}
if (vbus) {
ret = vbus->probe();
- if (ret)
+ if (ret) {
RTE_LOG(ERR, EAL, "Bus (%s) probe failed.\n",
vbus->name);
+ return ret;
+ }
}
return 0;