On Sat, Feb 22, 2020 at 10:48 AM Daniel Vetter <daniel.vetter@xxxxxxxx> wrote: > > On Fri, Feb 21, 2020 at 10:36 PM Chris Wilson <chris@xxxxxxxxxxxxxxxxxx> wrote: > > Quoting Daniel Vetter (2020-02-21 21:02:30) > > > For two reasons: > > > > > > - The driver core clears this already for us after we're unloaded in > > > __device_release_driver(). > > > > Even if we abort before loading? > > > > History notes that i915_pci_remove was called with a stale pointer on > > error. > > So even if there's a bug we still have the problem that clearing the > pci_drvdata in our drm_driver->release hook is way too late. You could > already have bound a new driver to the underlying device. So if driver > core doesn't clear drvdata on bind failure and we need to clear this > ourselves, then this line here could actually clear the drvdata of the > next driver instance bound to the pci device. Not that that's ever > going to happen outside of very contrived testing. > > But looking at really_probe() in base/dd.c we do clear drvdata on > failure. So no idea how/why that stale drvdata came to be. Anyway > that's kinda why I cc'ed Greg, so he could confirm that this is > correct. Looking at git history, this was fixed in driver core in commit 0998d0631001288a5974afc0b2a5f568bcdecb4d Author: Hans de Goede <hdegoede@xxxxxxxxxx> Date: Wed May 23 00:09:34 2012 +0200 device-core: Ensure drvdata = NULL when no driver is bound I'll add that to the commit message. -Daniel -- Daniel Vetter Software Engineer, Intel Corporation +41 (0) 79 365 57 48 - http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list Intel-gfx@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/intel-gfx