]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
drm/i915: Fix error handling if driver creation fails during probe
authorMatt Roper <matthew.d.roper@intel.com>
Thu, 1 Jun 2023 17:38:04 +0000 (10:38 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 12:52:42 +0000 (14:52 +0200)
commit 718551bbed3ca5308a9f9429305dd074727e8d46 upstream.

If i915_driver_create() fails to create a valid 'i915' object, we
should just disable the PCI device and return immediately without trying
to call i915_probe_error() that relies on a valid i915 pointer.

Fixes: 12e6f6dc78e4 ("drm/i915/display: Handle GMD_ID identification in display code")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Closes: https://lore.kernel.org/all/55236f93-dcc5-481e-b788-9f7e95b129d8@kili.mountain/
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Reviewed-by: Gustavo Sousa <gustavo.sousa@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230601173804.557756-1-matthew.d.roper@intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/i915/i915_driver.c

index 664c55f0ed4c51ff4bd6fdc6beb481c6238fe03f..46834299a7d5733fb5a80225e590903422e5e792 100644 (file)
@@ -747,8 +747,8 @@ int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        i915 = i915_driver_create(pdev, ent);
        if (IS_ERR(i915)) {
-               ret = PTR_ERR(i915);
-               goto out_pci_disable;
+               pci_disable_device(pdev);
+               return PTR_ERR(i915);
        }
 
        ret = i915_driver_early_probe(i915);