rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Danilo Krummrich <dakr@kernel.org>
To: airlied@gmail.com, simona@ffwll.ch,
	maarten.lankhorst@linux.intel.com, mripard@kernel.org,
	tzimmermann@suse.de, ojeda@kernel.org, alex.gaynor@gmail.com,
	boqun.feng@gmail.com, gary@garyguo.net, bjorn3_gh@protonmail.com,
	lossin@kernel.org, aliceryhl@google.com, tmgross@umich.edu,
	acourbot@nvidia.com, alyssa@rosenzweig.io, lyude@redhat.com
Cc: rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] rust: drm: device: drop_in_place() the drm::Device in release()
Date: Fri, 4 Jul 2025 00:42:46 +0200	[thread overview]
Message-ID: <aGcHZtAGnnJBanRy@pollux> (raw)
In-Reply-To: <20250629153747.72536-1-dakr@kernel.org>

On Sun, Jun 29, 2025 at 05:37:42PM +0200, Danilo Krummrich wrote:
> In drm::Device::new() we allocate with __drm_dev_alloc() and return an
> ARef<drm::Device>.
> 
> When the reference count of the drm::Device falls to zero, the C code
> automatically calls drm_dev_release(), which eventually frees the memory
> allocated in drm::Device::new().
> 
> However, due to that, drm::Device::drop() is never called. As a result
> the destructor of the user's private data, i.e. drm::Device::data is
> never called. Hence, fix this by calling drop_in_place() from the DRM
> device's release callback.
> 
> Fixes: 1e4b8896c0f3 ("rust: drm: add device abstraction")
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

Applied to drm-misc-fixes, thanks!

      parent reply	other threads:[~2025-07-03 22:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-29 15:37 [PATCH] rust: drm: device: drop_in_place() the drm::Device in release() Danilo Krummrich
2025-07-03 21:26 ` Alice Ryhl
2025-07-03 22:42 ` Danilo Krummrich [this message]

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=aGcHZtAGnnJBanRy@pollux \
    --to=dakr@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=airlied@gmail.com \
    --cc=alex.gaynor@gmail.com \
    --cc=aliceryhl@google.com \
    --cc=alyssa@rosenzweig.io \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun.feng@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gary@garyguo.net \
    --cc=lossin@kernel.org \
    --cc=lyude@redhat.com \
    --cc=maarten.lankhorst@linux.intel.com \
    --cc=mripard@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=simona@ffwll.ch \
    --cc=tmgross@umich.edu \
    --cc=tzimmermann@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).