]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
media: atmel: atmel-isc: fix INIT_WORK misplacement
authorEugen Hristev <eugen.hristev@microchip.com>
Fri, 12 Apr 2019 10:19:46 +0000 (06:19 -0400)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:21:44 +0000 (14:21 -0300)
BugLink: https://bugs.launchpad.net/bugs/1855787
commit 79199002db5c571e335131856b3ff057ffd9f3c0 upstream.

In case the completion function failes, unbind will be called
which will call cancel_work for awb_work.
This will trigger a WARN message from the workqueue.
To avoid this, move the INIT_WORK call at the start of the completion
function. This way the work is always initialized, which corresponds
to the 'always canceled' unbind code.

Fixes: 93d4a26c3d ("[media] atmel-isc: add the isc pipeline function")
Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/media/platform/atmel/atmel-isc.c

index ad12bc4a996f106dc8fe7487da1a702ca36d7f6c..75e4f1027fc74f9a2840906fef68c84858a8d123 100644 (file)
@@ -1901,6 +1901,8 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
        struct vb2_queue *q = &isc->vb2_vidq;
        int ret;
 
+       INIT_WORK(&isc->awb_work, isc_awb_work);
+
        ret = v4l2_device_register_subdev_nodes(&isc->v4l2_dev);
        if (ret < 0) {
                v4l2_err(&isc->v4l2_dev, "Failed to register subdev nodes\n");
@@ -1954,8 +1956,6 @@ static int isc_async_complete(struct v4l2_async_notifier *notifier)
                return ret;
        }
 
-       INIT_WORK(&isc->awb_work, isc_awb_work);
-
        /* Register video device */
        strlcpy(vdev->name, ATMEL_ISC_NAME, sizeof(vdev->name));
        vdev->release           = video_device_release_empty;