Currently, when setting up a CDX device, we attempt to enable bus
mastering, and we are meant to tolerate devices that do not support
configuring it, which is reported as ENOTTY. However, the check compares
errno against -ENOTTY, so the comparison can never match, and any failure
to enable bus mastering fails device setup.

Fix it by comparing against positive ENOTTY.

Fixes: 2284d67261ec ("bus/cdx: add bus master enable/disable API")
Cc: [email protected]
Cc: [email protected]

Signed-off-by: Anatoly Burakov <[email protected]>
---
 drivers/bus/cdx/cdx_vfio.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/cdx/cdx_vfio.c b/drivers/bus/cdx/cdx_vfio.c
index 7a554472c24..7e1f30c3764 100644
--- a/drivers/bus/cdx/cdx_vfio.c
+++ b/drivers/bus/cdx/cdx_vfio.c
@@ -268,7 +268,7 @@ cdx_vfio_setup_device(struct rte_cdx_device *dev, int 
vfio_dev_fd,
         * Enable Bus mastering for the device. errno is set as ENOTTY if
         * device does not support configuring bus master.
         */
-       if (rte_cdx_vfio_bm_enable(dev) && (errno != -ENOTTY)) {
+       if (rte_cdx_vfio_bm_enable(dev) && (errno != ENOTTY)) {
                CDX_BUS_ERR("Bus master enable failure! Error: %d (%s)", errno,
                        strerror(errno));
                return -1;
-- 
2.52.0

Reply via email to