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 <kees@xxxxxxxxxxxx> Closes: https://lore.kernel.org/dri-devel/8c5bfc12-cbcc-4102-9826-494060df4179@xxxxxxxxxxxx/ Signed-off-by: Thomas Zimmermann <tzimmermann@xxxxxxx> Fixes: 04826f588682 ("drm/bochs: Allocate DRM device in struct bochs_device") Cc: Thomas Zimmermann <tzimmermann@xxxxxxx> Cc: Gerd Hoffmann <kraxel@xxxxxxxxxx> Cc: virtualization@xxxxxxxxxxxxxxx --- drivers/gpu/drm/tiny/bochs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tiny/bochs.c b/drivers/gpu/drm/tiny/bochs.c index 5d2d34976d4b..3ba7f09f3e7b 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); -- 2.46.0