mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 22:52:19 +02:00
media: amphion: Set video drvdata before register video device
The video drvdata should be set before the video device is registered,
otherwise video_drvdata() may return NULL in the open() file ops, and led
to oops.
Fixes: 3cd084519c ("media: amphion: add vpu v4l2 m2m support")
Cc: <stable@vger.kernel.org>
Signed-off-by: Ming Qian <ming.qian@nxp.com>
Reviewed-by: TaoJiang <tao.jiang_2@nxp.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
This commit is contained in:
parent
d2b7ecc26b
commit
8cbb1a7bd5
|
|
@ -841,6 +841,7 @@ int vpu_add_func(struct vpu_dev *vpu, struct vpu_func *func)
|
|||
vfd->fops = vdec_get_fops();
|
||||
vfd->ioctl_ops = vdec_get_ioctl_ops();
|
||||
}
|
||||
video_set_drvdata(vfd, vpu);
|
||||
|
||||
ret = video_register_device(vfd, VFL_TYPE_VIDEO, -1);
|
||||
if (ret) {
|
||||
|
|
@ -848,7 +849,6 @@ int vpu_add_func(struct vpu_dev *vpu, struct vpu_func *func)
|
|||
v4l2_m2m_release(func->m2m_dev);
|
||||
return ret;
|
||||
}
|
||||
video_set_drvdata(vfd, vpu);
|
||||
func->vfd = vfd;
|
||||
|
||||
ret = v4l2_m2m_register_media_controller(func->m2m_dev, func->vfd, func->function);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user