Starting with commit ec3e00b4ee27 ("drm/i915: stop registering if drm_dev_register() fails"), we return from i915_driver_register() immediately if drm_dev_register() fails, skipping remaining registration steps, and continue only with remaining probe steps. However, the _unregister() counterpart called at driver remove knows nothing about that skip and executes reverts of all those steps. As a consequence, a number of kernel warnings that taint the kernel are triggered: Fix the asymmetry by failing the driver probe on device registration failure and going through rewind paths. For that to work as expected, add missing PXP cleanup to probe error rewind path. Also, downgrade device registration error message if the error is injected by a test. v5: Drop unsigned keyword from ret variable declaration (Krzysztof), - downgrde severity of injected device register errors with i915_prober_error() in a separate patch, then keep then "Failed to register driver for userspace access" error message (Krzysztof), - split PXP cleanup addition to rewind path out to a separate patch. v4: Switch to taking an error rewind path on device registration failure (Krzysztof, Lucas). v3: Based on Andi's commitment on introducing a flag, try to address Jani's "must find another way" by finding a better place and name for the flag (in hope that's what Jani had on mind), - split into a series of patches and limit the scope of the first (this) one to a minimum of omitting conditionally only those unregister (sub)steps that trigger kernel warnings when not registered. v2: Check in _unregister whether the drm_dev_register has succeeded and skip some of the _unregister() steps. (Andi) Cc: Andi Shyti <andi.shyti@xxxxxxxxxxxxxxx> Cc: Krzysztof Niemiec <krzysztof.niemiec@xxxxxxxxx> Cc: Lucas De Marchi <lucas.demarchi@xxxxxxxxx> Janusz Krzysztofik (3): drm/i915: Downgrade device register error if injected drm/i915: Fix PXP cleanup missing from probe error rewind drm/i915: Fix harmful driver register/unregister asymmetry drivers/gpu/drm/i915/i915_driver.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) -- 2.48.1