Skip to contentSkip to conversation

pci/vfio: fixup rte_intr_callback_unregister() handling

PATCH Applied Darek Stojaczyk 4 participants 5 messages Oct 24, 2018 – Nov 20, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 pci/vfio: fixup rte_intr_callback_unregister() handling

This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore.

Fixes c115fd000c32 ("vfio: handle hotplug request notifier")
---
 drivers/bus/pci/linux/pci_vfio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +2 -2
index b1f0683fe..305cc0601 100644
@@ -341,7 +341,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 						 pci_vfio_req_handler,
 						 (void *)&dev->device);
-		if (ret)
+		if (ret < 0)
 			RTE_LOG(ERR, EAL,
 				"Fail to unregister req notifier handler.\n");
 		goto error;
@@ -373,7 +373,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 	ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 					   pci_vfio_req_handler,
 					   (void *)&dev->device);
-	if (ret) {
+	if (ret < 0) {
 		RTE_LOG(ERR, EAL,
 			 "fail to unregister req notifier handler.\n");
 		return -1;
Signature · 1 line
2.17.1
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Darek Stojaczyk

This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore.

Fixes c115fd000c32 ("vfio: handle hotplug request notifier")

---

Signature · 2 lines
Thanks,
Anatoly
#2 lore raw

26/10/2018 16:23, Burakov, Anatoly:

Quoted 8 lines · Darek Stojaczyk
Quoted 7 lines

This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore.

Fixes c115fd000c32 ("vfio: handle hotplug request notifier")

No need for stable backport here.

Quoted 3 lines
Quoted 1 line

Applied, thanks

#3 lore raw
In reply to Darek Stojaczyk
Quoted 7 lines · Darek Stojaczyk

This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore.

Fixes c115fd000c32 ("vfio: handle hotplug request notifier")

The Fixes: commit indicates this is not for stable, and the modified function was added in that commit. If there is some equivalent fix for stable, please send a backport for that.

Quoted 29 lines
---
 drivers/bus/pci/linux/pci_vfio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +2 -2
index b1f0683fe..305cc0601 100644
@@ -341,7 +341,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 						 pci_vfio_req_handler,
 						 (void *)&dev->device);
-		if (ret)
+		if (ret < 0)
 			RTE_LOG(ERR, EAL,
 				"Fail to unregister req notifier handler.\n");
 		goto error;
@@ -373,7 +373,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 	ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 					   pci_vfio_req_handler,
 					   (void *)&dev->device);
-	if (ret) {
+	if (ret < 0) {
 		RTE_LOG(ERR, EAL,
 			 "fail to unregister req notifier handler.\n");
 		return -1;
#4 lore raw
Quoted 5 lines · Kevin Traynor
Quoted 4 lines · Darek Stojaczyk

This function is documented to return the number of unregistered callbacks or negative numbers on error, but pci_vfio checks for ret != 0 to detect failures. Not anymore.

Quoted 8 lines
Quoted 3 lines
Fixes c115fd000c32 ("vfio: handle hotplug request notifier")

The Fixes: commit indicates this is not for stable, and the modified function was added in that commit. If there is some equivalent fix for stable, please send a backport for that.

oh, I should have read the rest of the thread before replying. Ignore previous mail, thanks.

Quoted 30 lines
Quoted 29 lines
---
 drivers/bus/pci/linux/pci_vfio.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bus/pci/linux/pci_vfio.c +2 -2
index b1f0683fe..305cc0601 100644
@@ -341,7 +341,7 @@ pci_vfio_enable_notifier(struct rte_pci_device *dev, int vfio_dev_fd)
 		ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 						 pci_vfio_req_handler,
 						 (void *)&dev->device);
-		if (ret)
+		if (ret < 0)
 			RTE_LOG(ERR, EAL,
 				"Fail to unregister req notifier handler.\n");
 		goto error;
@@ -373,7 +373,7 @@ pci_vfio_disable_notifier(struct rte_pci_device *dev)
 	ret = rte_intr_callback_unregister(&dev->vfio_req_intr_handle,
 					   pci_vfio_req_handler,
 					   (void *)&dev->device);
-	if (ret) {
+	if (ret < 0) {
 		RTE_LOG(ERR, EAL,
 			 "fail to unregister req notifier handler.\n");
 		return -1;