media: usb: null check create_singlethread_workqueue
authorNavid Emamdoost <navid.emamdoost@gmail.com>
Wed, 11 Sep 2019 20:26:00 +0000 (17:26 -0300)
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>
Thu, 10 Oct 2019 10:18:10 +0000 (07:18 -0300)
In sd_start return value of create_singlethread_workqueue needs null
check.

Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
drivers/media/usb/gspca/sq905.c

index 863c485f42753cb8127e47e995ed113445e81099..97799cfb832e380f92dce95a44cc656cc3455052 100644 (file)
@@ -378,6 +378,9 @@ static int sd_start(struct gspca_dev *gspca_dev)
        }
        /* Start the workqueue function to do the streaming */
        dev->work_thread = create_singlethread_workqueue(MODULE_NAME);
+       if (!dev->work_thread)
+               return -ENOMEM;
+
        queue_work(dev->work_thread, &dev->work_struct);
 
        return 0;