]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - drivers/media/video/pvrusb2/pvrusb2-context.c
V4L/DVB (6688): V4L: fix copy and paste error in dprintk for videobuf-vmalloc.c
[mirror_ubuntu-bionic-kernel.git] / drivers / media / video / pvrusb2 / pvrusb2-context.c
index cf129746205dbae6e1775cd8fb7d0350b9ea5bcd..22719ba861aceb2d0e0c3f2b70b467b39ef26de9 100644 (file)
@@ -33,8 +33,10 @@ static void pvr2_context_destroy(struct pvr2_context *mp)
 {
        if (mp->hdw) pvr2_hdw_destroy(mp->hdw);
        pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr_main id=%p",mp);
-       flush_workqueue(mp->workqueue);
-       destroy_workqueue(mp->workqueue);
+       if (mp->workqueue) {
+               flush_workqueue(mp->workqueue);
+               destroy_workqueue(mp->workqueue);
+       }
        kfree(mp);
 }
 
@@ -83,9 +85,8 @@ struct pvr2_context *pvr2_context_create(
        void (*setup_func)(struct pvr2_context *))
 {
        struct pvr2_context *mp = NULL;
-       mp = kmalloc(sizeof(*mp),GFP_KERNEL);
+       mp = kzalloc(sizeof(*mp),GFP_KERNEL);
        if (!mp) goto done;
-       memset(mp,0,sizeof(*mp));
        pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr_main id=%p",mp);
        mp->setup_func = setup_func;
        mutex_init(&mp->mutex);