samples: vfio-mdev: fix return value of error branch in mdpy_fb_probe()
Subsystems (2)
PATCH 1/1 samples: vfio-mdev: fix return value of error branch in mdpy_fb_probe()
pci_release_regions() should be called in these error branches, so I set ret and use goto err_release_regions intead of simply return -EINVAL.
Fixes cacade1946a4 ("sample: vfio mdev display - guest driver")
Reported-by Hulk Robot <[email protected]>
Signed-off-by Qinglang Miao <[email protected]>
--- samples/vfio-mdev/mdpy-fb.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
samples/vfio-mdev/mdpy-fb.c +6 -3
@@ -117,15 +117,18 @@ static int mdpy_fb_probe(struct pci_dev *pdev,if (format !=DRM_FORMAT_XRGB8888 ) {pci_err (pdev,"format mismatch (0x%x != 0x%x)\n" , format,DRM_FORMAT_XRGB8888 ); -return -EINVAL ; + ret = -EINVAL ; + goto err_release_regions; }if (width <100 || width >10000 ) {pci_err (pdev,"width (%d) out of range\n" , width); -return -EINVAL ; + ret = -EINVAL ; + goto err_release_regions; }if (height <100 || height >10000 ) {pci_err (pdev,"height (%d) out of range\n" , height); -return -EINVAL ; + ret = -EINVAL ; + goto err_release_regions; }pci_info (pdev,"mdpy found: %dx%d framebuffer\n" , width, height);
Signature · 1 line
2.23.0