From: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
To: Andi Shyti <andi.shyti@kernel.org>
Cc: <dri-devel@lists.freedesktop.org>,
<intel-gfx@lists.freedesktop.org>,
Krzysztof Karas <krzysztof.karas@intel.com>,
Simona Vetter <simona@ffwll.ch>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
David Airlie <airlied@gmail.com>,
Sebastian Brzezinka <sebastian.brzezinka@intel.com>,
Janusz Krzysztofik <janusz.krzysztofik@linux.intel.com>,
Andi Shyti <andi.shyti@linux.intel.com>
Subject: Re: [PATCH v3 1/2] drm: Unwind drm device registration upon error
Date: Wed, 2 Sep 2026 12:41:20 +0200 [thread overview]
Message-ID: <apf2bCiuKcmcRHUT@kniemiec-mobl1> (raw)
In-Reply-To: <apC_eePJyeGnVQTG@zenone.zhora.eu>
On 2026-08-28 at 01:14:57 +0200, Andi Shyti wrote:
> Hi Krzysztof,
>
> ...
>
> > Amend the problem by removing debugfs entries and marking
> > registered flag as false upon error in drm_dev_register().
> >
> > Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
> > Co-developed-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
> > Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
>
> I think the right order should be:
>
> Co-developed-by: Krzysztof Karas <krzysztof.karas@intel.com>
> Signed-off-by: Krzysztof Karas <krzysztof.karas@intel.com>
> Signed-off-by: Krzysztof Niemiec <krzysztof.niemiec@intel.com>
>
> > diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
> > index e51ed959da89..b98e8af6f1c1 100644
> > --- a/drivers/gpu/drm/drm_drv.c
> > +++ b/drivers/gpu/drm/drm_drv.c
> > @@ -1140,6 +1140,8 @@ int drm_dev_register(struct drm_device *dev, unsigned long flags)
> > drm_minor_unregister(dev, DRM_MINOR_ACCEL);
> > drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
> > drm_minor_unregister(dev, DRM_MINOR_RENDER);
> > + drm_debugfs_dev_fini(dev);
>
> I think sashiko is right here, this should be removed.
>
> > + dev->registered = false;
>
> dev->registered = false should be set at the very beginning,
> maybe something like this:
Why? Is .unload() supposed to expect dev->registered = false? I've seen
that moving the flag around might(?) make a bit of a mess (e0f32f78e51b),
and before this patch .unload() is being called with registered = true.
So changing it at the beginning of the unwind might mess up drivers that
rely on it, but it will make no difference for drivers that don't, so
I'd rather keep it this way. Unless we make explicit guarantees that
.unload() will be called with ->registered = false, in the middle of the
call to drm_dev_register().
>
> err_unload:
> dev->registered = false;
> if (dev->driver->unload)
> dev->driver->unload(dev);
> goto err_cleanup;
> err_minors:
> dev->registered = false;
> err_clenup:
> ...
>
> Thanks,
> Andi
next prev parent reply other threads:[~2026-09-02 10:41 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 14:34 [PATCH v3 0/2] DRM device registration fixes Krzysztof Niemiec
2026-08-27 14:34 ` [PATCH v3 1/2] drm: Unwind drm device registration upon error Krzysztof Niemiec
2026-08-27 14:52 ` sashiko-bot
2026-08-27 23:14 ` Andi Shyti
2026-09-02 10:41 ` Krzysztof Niemiec [this message]
2026-08-27 14:34 ` [PATCH v3 2/2] drm/i915: Remove drm_dev_unregister() from the error path during i915_driver_register() Krzysztof Niemiec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=apf2bCiuKcmcRHUT@kniemiec-mobl1 \
--to=krzysztof.niemiec@intel.com \
--cc=airlied@gmail.com \
--cc=andi.shyti@kernel.org \
--cc=andi.shyti@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=janusz.krzysztofik@linux.intel.com \
--cc=krzysztof.karas@intel.com \
--cc=maarten.lankhorst@linux.intel.com \
--cc=sebastian.brzezinka@intel.com \
--cc=simona@ffwll.ch \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox