Skip to contentSkip to conversation

samples: vfio-mdev: fix error return code in mdpy_fb_probe()

PATCH New Wei Yongjun 1 participant 1 message Apr 27, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 samples: vfio-mdev: fix error return code in mdpy_fb_probe()

Fix to return negative error code -ENOMEM from the error handling case instead of 0, as done elsewhere in this function.

---
 samples/vfio-mdev/mdpy-fb.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
samples/vfio-mdev/mdpy-fb.c +3 -1
index 21dbf63d6e41..d4abc0594dbd 100644
@@ -131,8 +131,10 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
 		 width, height);
 
 	info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
-	if (!info)
+	if (!info) {
+		ret = -ENOMEM;
 		goto err_release_regions;
+	}
 	pci_set_drvdata(pdev, info);
 	par = info->par;