media: imx-jpeg: Set video drvdata before register video device
Subsystems (4)
Ming Qian
maintainerPATCH 1/2 media: imx-jpeg: 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 2db16c6ed72c ("media: imx-jpeg: Add V4L2 driver for i.MX8 JPEG Encoder/Decoder")
Signed-off-by Ming Qian <[email protected]>
Reviewed-by TaoJiang <[email protected]>
--- drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +1 -1
@@ -2842,6 +2842,7 @@ static int mxc_jpeg_probe(struct platform_device *pdev) jpeg->dec_vdev->vfl_dir =VFL_DIR_M2M ; jpeg->dec_vdev->device_caps =V4L2_CAP_STREAMING |V4L2_CAP_VIDEO_M2M_MPLANE ; +video_set_drvdata (jpeg->dec_vdev, jpeg);if (mode ==MXC_JPEG_ENCODE ) {v4l2_disable_ioctl (jpeg->dec_vdev,VIDIOC_DECODER_CMD );v4l2_disable_ioctl (jpeg->dec_vdev,VIDIOC_TRY_DECODER_CMD );
@@ -2854,7 +2855,6 @@ static int mxc_jpeg_probe(struct platform_device *pdev)dev_err (dev,"failed to register video device\n" ); goto err_vdev_register; } -video_set_drvdata (jpeg->dec_vdev, jpeg);if (mode ==MXC_JPEG_ENCODE ) v4l2_info(&jpeg->v4l2_dev, "encoder device registered as /dev/video%d (%d,%d)\n",
Signature · 1 line
2.43.0-rc1
Ming Qian
maintainerPATCH 2/2 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 3cd084519c6f ("media: amphion: add vpu v4l2 m2m support")
Signed-off-by Ming Qian <[email protected]>
Reviewed-by TaoJiang <[email protected]>
--- drivers/media/platform/amphion/vpu_v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/amphion/vpu_v4l2.c +1 -1
@@ -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);
Signature · 1 line
2.43.0-rc1