From: Thomas Zimmermann Date: Fri, 4 Oct 2024 07:52:47 +0000 (+0200) Subject: drm/bochs: Return error from correct pointer X-Git-Tag: v6.13-rc1~122^2~18^2~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2d6d8b138f241c29da7c122918556e45e67f2660;p=thirdparty%2Fkernel%2Flinux.git drm/bochs: Return error from correct pointer In probe, return the error code from the variable bochs, not dev. The variable dev has not been initialized at this point. In the case of an allocation error, the returned value would have been undefined. Reported-by: Kees Bakker Closes: https://lore.kernel.org/dri-devel/8c5bfc12-cbcc-4102-9826-494060df4179@ijzerbout.nl/ Signed-off-by: Thomas Zimmermann Fixes: 04826f588682 ("drm/bochs: Allocate DRM device in struct bochs_device") Cc: Thomas Zimmermann Cc: Gerd Hoffmann Cc: virtualization@lists.linux.dev Reviewed-by: Javier Martinez Canillas Link: https://patchwork.freedesktop.org/patch/msgid/20241004075404.41743-1-tzimmermann@suse.de --- diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 5d2d34976d4b2..3ba7f09f3e7b9 100644 --- a/drivers/gpu/drm/tiny/bochs.c +++ b/drivers/gpu/drm/tiny/bochs.c @@ -717,7 +717,7 @@ static int bochs_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent bochs = devm_drm_dev_alloc(&pdev->dev, &bochs_driver, struct bochs_device, dev); if (IS_ERR(bochs)) - return PTR_ERR(dev); + return PTR_ERR(bochs); dev = &bochs->dev; ret = pcim_enable_device(pdev);