diff options
author | Ma Ke <make24@iscas.ac.cn> | 2025-03-19 11:02:48 +0300 |
---|---|---|
committer | Hans Verkuil <hverkuil@xs4all.nl> | 2025-05-09 12:55:06 +0300 |
commit | 2a934fdb01db6458288fc9386d3d8ceba6dd551a (patch) | |
tree | de05516e23af67f39b63057574faa4072d01ccb6 /tools/perf/scripts/python/export-to-postgresql.py | |
parent | 48dbb76cef65fabaa3ac97461eda90495e954ecd (diff) | |
download | linux-2a934fdb01db6458288fc9386d3d8ceba6dd551a.tar.xz |
media: v4l2-dev: fix error handling in __video_register_device()
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>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Diffstat (limited to 'tools/perf/scripts/python/export-to-postgresql.py')
0 files changed, 0 insertions, 0 deletions