media: vimc: zero the media_device on probe
authorHans Verkuil <hverkuil-cisco@xs4all.nl>
Fri, 8 Mar 2019 13:02:26 +0000 (08:02 -0500)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Tue, 19 Mar 2019 17:30:32 +0000 (13:30 -0400)
The media_device is part of a static global vimc_device struct.
The media framework expects this to be zeroed before it is
used, however, since this is a global this is not the case if
vimc is unbound and then bound again.

So call memset to ensure any left-over values are cleared.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/platform/vimc/vimc-core.c

index 0fbb7914098f67dca1e01481ebeec5e75284a3f7..3aa62d7e3d0e0c87952a0de9d31500a4fc4634de 100644 (file)
@@ -304,6 +304,8 @@ static int vimc_probe(struct platform_device *pdev)
 
        dev_dbg(&pdev->dev, "probe");
 
+       memset(&vimc->mdev, 0, sizeof(vimc->mdev));
+
        /* Create platform_device for each entity in the topology*/
        vimc->subdevs = devm_kcalloc(&vimc->pdev.dev, vimc->pipe_cfg->num_ents,
                                     sizeof(*vimc->subdevs), GFP_KERNEL);