Re: [PATCH v3] media: add virtio-media driver

From: Mauro Carvalho Chehab
Date: Sun Jun 01 2025 - 05:34:56 EST


Em Wed, 28 May 2025 18:23:02 +0200
Ricardo Ribalda <ribalda@xxxxxxxxxxxx> escreveu:

> > +static int scatterlist_builder_add_userptr(struct scatterlist_builder *builder,
> > + unsigned long userptr,
> > + unsigned long length)
> > +{
> > + int ret;
> > + int nents;
> Could you initialize nents and sg_list?
> old versions of gcc are a bit picky
> https://gitlab.freedesktop.org/linux-media/users/ribalda/-/jobs/77042562#L4381

Please don't. In this specific case, ret is always initialized:

> + struct virtio_media_sg_entry *sg_list;
> +
> + ret = __scatterlist_builder_add_userptr(builder, userptr, length,
> + &sg_list, &nents);

nents and sg_list may or may not be initialized at the function,
but initializing it is wrong, as, when they are not initialized, the
ret code shall catch it (and if not, we *do* want gcc to warn).

So, if our CI is warning about that due to an old version, please upgrade
the version at the CI runner.

Regards,
Mauro


Thanks,
Mauro