]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
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)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Wed, 14 Aug 2019 09:18:49 +0000 (11:18 +0200)
BugLink: https://bugs.launchpad.net/bugs/1838700
[ Upstream commit f74267b51cb36321f777807b2e04ca02167ecc08 ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
drivers/media/platform/vimc/vimc-core.c

index fe088a95386005798e1fd54adb7a64ccfb08cc78..9a24c547450c891a00c3fa5f3a78d465d2bf5f32 100644 (file)
@@ -303,6 +303,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);