Re: [PATCH v2 06/10] staging: media: zoran: fusion all modules

From: Dan Carpenter
Date: Thu Oct 14 2021 - 04:02:35 EST


On Wed, Oct 13, 2021 at 06:58:08PM +0000, Corentin Labbe wrote:
> The zoran driver is split in many modules, but this lead to some
> problems.
> One of them is that load order is incorrect when everything is built-in.
>
> Having more than one module is useless, so fusion all zoran modules in
^^^^^^
"fusion" isn't the right word. It should be "fuse" or even better
"merge". Same in the subject.

> one.
>
> Signed-off-by: Corentin Labbe <clabbe@xxxxxxxxxxxx>

[ snip ]

> +static int load_codec(struct zoran *zr, u16 codecid)
> +{
> + switch (codecid) {
> + case CODEC_TYPE_ZR36060:
> +#ifdef CONFIG_VIDEO_ZORAN_ZR36060
> + return zr36060_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36060 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + case CODEC_TYPE_ZR36050:
> +#ifdef CONFIG_VIDEO_ZORAN_DC30
> + return zr36050_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36050 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + case CODEC_TYPE_ZR36016:
> +#ifdef CONFIG_VIDEO_ZORAN_DC30
> + return zr36016_init_module();
> +#else
> + pci_err(zr->pci_dev, "ZR36016 support is not enabled\n");
> + return -EINVAL;
> +#endif
> + break;
> + }

Not related to your patch but if load_codec() fails, the probe function
still calls zoran_setup_videocodec() on the failed codec. It might be
better to set the codec to zero?

result = load_codec(zr, zr->card.video_codec);
if (result < 0) {
pci_err(pdev, "failed to load codec %s: %d\n", codec_name, result);
zr->card.video_codec = 0;
}

regards,
dan carpenter