From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Ma Ke <make24@iscas.ac.cn>
Cc: mchehab@kernel.org, hverkuil@xs4all.nl,
sebastian.fricke@collabora.com, ribalda@chromium.org,
benjamin.gaignard@collabora.com, viro@zeniv.linux.org.uk,
bartosz.golaszewski@linaro.org, hljunggr@cisco.com,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH v3] media: v4l2-dev: fix error handling in __video_register_device()
Date: Thu, 27 Mar 2025 10:49:03 +0000 [thread overview]
Message-ID: <Z-UtHzeewV-CvzfD@kekkonen.localdomain> (raw)
In-Reply-To: <20250319080248.1746847-1-make24@iscas.ac.cn>
On Wed, Mar 19, 2025 at 04:02:48PM +0800, Ma Ke wrote:
> Once device_register() failed, we should call put_device() to
> decrement reference count for cleanup. Or it could cause memory leak.
> And move callback function v4l2_device_release() and v4l2_device_get()
> before put_device().
>
> As comment of device_register() says, 'NOTE: _Never_ directly free
> @dev after calling this function, even if it returned an error! Always
> use put_device() to give up the reference initialized in this function
> instead.'
>
> Found by code review.
>
> Cc: stable@vger.kernel.org
> Fixes: dc93a70cc7f9 ("V4L/DVB (9973): v4l2-dev: use the release callback from device instead of cdev")
> Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
--
Sakari Ailus
prev parent reply other threads:[~2025-03-27 10:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-19 8:02 Ma Ke
2025-03-27 10:49 ` Sakari Ailus [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=Z-UtHzeewV-CvzfD@kekkonen.localdomain \
--to=sakari.ailus@linux.intel.com \
--cc=bartosz.golaszewski@linaro.org \
--cc=benjamin.gaignard@collabora.com \
--cc=hljunggr@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=make24@iscas.ac.cn \
--cc=mchehab@kernel.org \
--cc=ribalda@chromium.org \
--cc=sebastian.fricke@collabora.com \
--cc=stable@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®