[Intel-gfx] [bug report] drm/i915/display: Handle GMD_ID identification in display code

Dan Carpenter dan.carpenter at linaro.org
Fri May 26 12:00:12 UTC 2023


Hello Matt Roper,

The patch 12e6f6dc78e4: "drm/i915/display: Handle GMD_ID
identification in display code" from May 23, 2023, leads to the
following Smatch static checker warning:

	drivers/gpu/drm/i915/i915_driver.c:850 i915_driver_probe()
	error: 'i915' dereferencing possible ERR_PTR()

drivers/gpu/drm/i915/i915_driver.c
    752 int i915_driver_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
    753 {
    754         struct drm_i915_private *i915;
    755         int ret;
    756 
    757         ret = pci_enable_device(pdev);
    758         if (ret) {
    759                 pr_err("Failed to enable graphics device: %pe\n", ERR_PTR(ret));
    760                 return ret;
    761         }
    762 
    763         i915 = i915_driver_create(pdev, ent);
    764         if (IS_ERR(i915)) {
    765                 ret = PTR_ERR(i915);
    766                 goto out_pci_disable;
                        ^^^^^^^^^^^^^^^^^^^^^
i915 is an error pointer.

    767         }
    768 
    769         ret = i915_driver_early_probe(i915);
    770         if (ret < 0)
    771                 goto out_pci_disable;
    772 

[ snip ]

    819         return 0;
    820 
    821 out_cleanup_gem:
    822         i915_gem_suspend(i915);
    823         i915_gem_driver_remove(i915);
    824         i915_gem_driver_release(i915);
    825 out_cleanup_modeset2:
    826         /* FIXME clean up the error path */
    827         intel_display_driver_remove(i915);
    828         intel_irq_uninstall(i915);
    829         intel_display_driver_remove_noirq(i915);
    830         goto out_cleanup_modeset;
    831 out_cleanup_irq:
    832         intel_irq_uninstall(i915);
    833 out_cleanup_modeset:
    834         intel_display_driver_remove_nogem(i915);
    835 out_cleanup_hw:
    836         i915_driver_hw_remove(i915);
    837         intel_memory_regions_driver_release(i915);
    838         i915_ggtt_driver_release(i915);
    839         i915_gem_drain_freed_objects(i915);
    840         i915_ggtt_driver_late_release(i915);
    841 out_cleanup_mmio:
    842         i915_driver_mmio_release(i915);
    843 out_tiles_cleanup:
    844         intel_gt_release_all(i915);
    845 out_runtime_pm_put:
    846         enable_rpm_wakeref_asserts(&i915->runtime_pm);
    847         i915_driver_late_release(i915);
    848 out_pci_disable:
    849         pci_disable_device(pdev);
--> 850         i915_probe_error(i915, "Device initialization failed (%d)\n", ret);
                                 ^^^^
Oops.

    851         return ret;
    852 }

regards,
dan carpenter


More information about the Intel-gfx mailing list