Re: [PATCH 13/13] media: bttv: convert to vb2

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



One compiler warning below:

On 25/04/2023 02:10, Deborah Brouwer wrote:
> Convert this driver from the old videobuf framework to videobuf2.
> 
> Signed-off-by: Deborah Brouwer <deborah.brouwer@xxxxxxxxxxxxx>
> ---
>  drivers/media/pci/bt8xx/Kconfig       |   2 +-
>  drivers/media/pci/bt8xx/bttv-driver.c | 805 ++++++++------------------
>  drivers/media/pci/bt8xx/bttv-risc.c   | 265 +++++----
>  drivers/media/pci/bt8xx/bttv-vbi.c    | 239 +++-----
>  drivers/media/pci/bt8xx/bttvp.h       |  60 +-
>  5 files changed, 491 insertions(+), 880 deletions(-)
> 

<snip>

> @@ -3414,6 +3055,35 @@ static void vdev_init(struct bttv *btv,
>  		v4l2_disable_ioctl(vfd, VIDIOC_G_TUNER);
>  		v4l2_disable_ioctl(vfd, VIDIOC_S_TUNER);
>  	}
> +
> +	if (strcmp(type_name, "radio") == 0)
> +		return 0;
> +
> +	if (strcmp(type_name, "video") == 0) {
> +		q = &btv->capq;
> +		q->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
> +		q->ops = &bttv_video_qops;
> +	}
> +	if (strcmp(type_name, "vbi") == 0) {
> +		q = &btv->vbiq;
> +		q->type = V4L2_BUF_TYPE_VBI_CAPTURE;
> +		q->ops = &bttv_vbi_qops;
> +	}

I'm getting a compiler warning here:

drivers/media/pci/bt8xx/bttv-driver.c: In function 'vdev_init.isra':
drivers/media/pci/bt8xx/bttv-driver.c:3080:16: warning: 'q' may be used uninitialized [-Wmaybe-uninitialized]
 3080 |         q->dev = &btv->c.pci->dev;
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~
drivers/media/pci/bt8xx/bttv-driver.c:3044:27: note: 'q' was declared here
 3044 |         struct vb2_queue *q;
      |                           ^

I would change this to:

	if (strcmp(type_name, "video") == 0) {
		...
	} else if (strcmp(type_name, "vbi") == 0) {
		...
	} else {
		return -EINVAL;
	}



> +	q->timestamp_flags = V4L2_BUF_FLAG_TIMESTAMP_MONOTONIC;
> +	q->io_modes = VB2_MMAP | VB2_USERPTR | VB2_READ | VB2_DMABUF;
> +	q->mem_ops = &vb2_dma_sg_memops;
> +	q->drv_priv = btv;
> +	q->gfp_flags = __GFP_DMA32;
> +	q->buf_struct_size = sizeof(struct bttv_buffer);
> +	q->lock = &btv->lock;
> +	q->min_buffers_needed = 2;
> +	q->dev = &btv->c.pci->dev;
> +	err = vb2_queue_init(q);
> +	if (err)
> +		return err;
> +	vfd->queue = q;
> +
> +	return 0;
>  }

Regards,

	Hans




[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]

  Powered by Linux