aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2022-06-18 17:26:08 +0200
committerGerd Hoffmann <kraxel@redhat.com>2022-07-19 14:40:59 +0200
commit8f48dbd6deaf5a14c924c1de08bf7e36526bf3e7 (patch)
tree7b897691950a8288ab76a5ded5376b22e3671f97 /drivers
parentdrm/virtio: kms: use drm managed resources (diff)
downloadlinux-dev-8f48dbd6deaf5a14c924c1de08bf7e36526bf3e7.tar.xz
linux-dev-8f48dbd6deaf5a14c924c1de08bf7e36526bf3e7.zip
drm/bochs: Fix some error handling paths in bochs_pci_probe()
The remove() function calls bochs_hw_fini() but this function is not called in the error handling of the probe. This call releases the resources allocated by bochs_hw_init() used in bochs_load(). Update the probe and bochs_load() to call bochs_hw_fini() if an error occurs after a successful bochs_hw_init() call. Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: http://patchwork.freedesktop.org/patch/msgid/0e676e4d56ab5b10fcf22860081414445611dfa7.1655565953.git.christophe.jaillet@wanadoo.fr Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/tiny/bochs.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c
index 82364a0a7b18..08de13774862 100644
--- a/drivers/gpu/drm/tiny/bochs.c
+++ b/drivers/gpu/drm/tiny/bochs.c
@@ -583,13 +583,17 @@ static int bochs_load(struct drm_device *dev)
ret = drmm_vram_helper_init(dev, bochs->fb_base, bochs->fb_size);
if (ret)
- return ret;
+ goto err_hw_fini;
ret = bochs_kms_init(bochs);
if (ret)
- return ret;
+ goto err_hw_fini;
return 0;
+
+err_hw_fini:
+ bochs_hw_fini(dev);
+ return ret;
}
DEFINE_DRM_GEM_FOPS(bochs_fops);
@@ -664,11 +668,13 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent
ret = drm_dev_register(dev, 0);
if (ret)
- goto err_free_dev;
+ goto err_hw_fini;
drm_fbdev_generic_setup(dev, 32);
return ret;
+err_hw_fini:
+ bochs_hw_fini(dev);
err_free_dev:
drm_dev_put(dev);
return ret;