Skip to content

Commit 182b9ed

Browse files
mingqian-0gregkh
authored andcommitted
media: amphion: Set video drvdata before register video device
commit 8cbb1a7 upstream. 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: 3cd0845 ("media: amphion: add vpu v4l2 m2m support") Cc: <[email protected]> Signed-off-by: Ming Qian <[email protected]> Reviewed-by: TaoJiang <[email protected]> Signed-off-by: Hans Verkuil <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent c98586d commit 182b9ed

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/media/platform/amphion/vpu_v4l2.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,14 +841,14 @@ int vpu_add_func(struct vpu_dev *vpu, struct vpu_func *func)
841841
vfd->fops = vdec_get_fops();
842842
vfd->ioctl_ops = vdec_get_ioctl_ops();
843843
}
844+
video_set_drvdata(vfd, vpu);
844845

845846
ret = video_register_device(vfd, VFL_TYPE_VIDEO, -1);
846847
if (ret) {
847848
video_device_release(vfd);
848849
v4l2_m2m_release(func->m2m_dev);
849850
return ret;
850851
}
851-
video_set_drvdata(vfd, vpu);
852852
func->vfd = vfd;
853853

854854
ret = v4l2_m2m_register_media_controller(func->m2m_dev, func->vfd, func->function);

0 commit comments

Comments
 (0)