#include <linux/err.h>
 #include <linux/i2c.h>
 #include <linux/list.h>
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/mutex.h>
 #include <linux/of.h>
        if (!notifier->v4l2_dev)
                return;
 
-       dev = kmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
+       dev = kvmalloc_array(n_subdev, sizeof(*dev), GFP_KERNEL);
        if (!dev) {
                dev_err(notifier->v4l2_dev->dev,
                        "Failed to allocate device cache!\n");
                }
                put_device(d);
        }
-       kfree(dev);
+       kvfree(dev);
 
        notifier->v4l2_dev = NULL;
 
 
  */
 
 #include <linux/ctype.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/export.h>
 #include <media/v4l2-ioctl.h>
        INIT_LIST_HEAD(&hdl->ctrls);
        INIT_LIST_HEAD(&hdl->ctrl_refs);
        hdl->nr_of_buckets = 1 + nr_of_controls_hint / 8;
-       hdl->buckets = kcalloc(hdl->nr_of_buckets, sizeof(hdl->buckets[0]),
-                              GFP_KERNEL);
+       hdl->buckets = kvmalloc_array(hdl->nr_of_buckets,
+                                     sizeof(hdl->buckets[0]),
+                                     GFP_KERNEL | __GFP_ZERO);
        hdl->error = hdl->buckets ? 0 : -ENOMEM;
        return hdl->error;
 }
                list_del(&ctrl->node);
                list_for_each_entry_safe(sev, next_sev, &ctrl->ev_subs, node)
                        list_del(&sev->node);
-               kfree(ctrl);
+               kvfree(ctrl);
        }
-       kfree(hdl->buckets);
+       kvfree(hdl->buckets);
        hdl->buckets = NULL;
        hdl->cached = NULL;
        hdl->error = 0;
                 is_array)
                sz_extra += 2 * tot_ctrl_size;
 
-       ctrl = kzalloc(sizeof(*ctrl) + sz_extra, GFP_KERNEL);
+       ctrl = kvzalloc(sizeof(*ctrl) + sz_extra, GFP_KERNEL);
        if (ctrl == NULL) {
                handler_set_err(hdl, -ENOMEM);
                return NULL;
        }
 
        if (handler_new_ref(hdl, ctrl)) {
-               kfree(ctrl);
+               kvfree(ctrl);
                return NULL;
        }
        mutex_lock(hdl->lock);
                return class_check(hdl, cs->which);
 
        if (cs->count > ARRAY_SIZE(helper)) {
-               helpers = kmalloc_array(cs->count, sizeof(helper[0]),
-                                       GFP_KERNEL);
+               helpers = kvmalloc_array(cs->count, sizeof(helper[0]),
+                                        GFP_KERNEL);
                if (helpers == NULL)
                        return -ENOMEM;
        }
        }
 
        if (cs->count > ARRAY_SIZE(helper))
-               kfree(helpers);
+               kvfree(helpers);
        return ret;
 }
 EXPORT_SYMBOL(v4l2_g_ext_ctrls);
                return class_check(hdl, cs->which);
 
        if (cs->count > ARRAY_SIZE(helper)) {
-               helpers = kmalloc_array(cs->count, sizeof(helper[0]),
-                                       GFP_KERNEL);
+               helpers = kvmalloc_array(cs->count, sizeof(helper[0]),
+                                        GFP_KERNEL);
                if (!helpers)
                        return -ENOMEM;
        }
        }
 
        if (cs->count > ARRAY_SIZE(helper))
-               kfree(helpers);
+               kvfree(helpers);
        return ret;
 }
 
 
 #include <media/v4l2-fh.h>
 #include <media/v4l2-event.h>
 
+#include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
 #include <linux/export.h>
        if (elems < 1)
                elems = 1;
 
-       sev = kzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems, GFP_KERNEL);
+       sev = kvzalloc(sizeof(*sev) + sizeof(struct v4l2_kevent) * elems,
+                      GFP_KERNEL);
        if (!sev)
                return -ENOMEM;
        for (i = 0; i < elems; i++)
        spin_unlock_irqrestore(&fh->vdev->fh_lock, flags);
 
        if (found_ev) {
-               kfree(sev);
+               kvfree(sev);
                return 0; /* Already listening */
        }
 
        if (sev && sev->ops && sev->ops->del)
                sev->ops->del(sev);
 
-       kfree(sev);
+       kvfree(sev);
 
        return 0;
 }
 
  *              Mauro Carvalho Chehab <mchehab@infradead.org> (version 2)
  */
 
+#include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/slab.h>
 #include <linux/types.h>
                        parg = sbuf;
                } else {
                        /* too big to allocate from stack */
-                       mbuf = kmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
+                       mbuf = kvmalloc(_IOC_SIZE(cmd), GFP_KERNEL);
                        if (NULL == mbuf)
                                return -ENOMEM;
                        parg = mbuf;
                 * array) fits into sbuf (so that mbuf will still remain
                 * unused up to here).
                 */
-               mbuf = kmalloc(array_size, GFP_KERNEL);
+               mbuf = kvmalloc(array_size, GFP_KERNEL);
                err = -ENOMEM;
                if (NULL == mbuf)
                        goto out_array_args;
        }
 
 out:
-       kfree(mbuf);
+       kvfree(mbuf);
        return err;
 }
 EXPORT_SYMBOL(video_usercopy);
 
  */
 
 #include <linux/ioctl.h>
+#include <linux/mm.h>
 #include <linux/slab.h>
 #include <linux/types.h>
 #include <linux/videodev2.h>
        if (!sd->entity.num_pads)
                return NULL;
 
-       cfg = kcalloc(sd->entity.num_pads, sizeof(*cfg), GFP_KERNEL);
+       cfg = kvmalloc_array(sd->entity.num_pads, sizeof(*cfg),
+                            GFP_KERNEL | __GFP_ZERO);
        if (!cfg)
                return NULL;
 
        ret = v4l2_subdev_call(sd, pad, init_cfg, cfg);
        if (ret < 0 && ret != -ENOIOCTLCMD) {
-               kfree(cfg);
+               kvfree(cfg);
                return NULL;
        }
 
 
 void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg)
 {
-       kfree(cfg);
+       kvfree(cfg);
 }
 EXPORT_SYMBOL_GPL(v4l2_subdev_free_pad_config);
 #endif /* CONFIG_MEDIA_CONTROLLER */
 
        buf->num_pages = size >> PAGE_SHIFT;
        buf->dma_sgt = &buf->sg_table;
 
-       buf->pages = kzalloc(buf->num_pages * sizeof(struct page *),
-                            GFP_KERNEL);
+       buf->pages = kvmalloc_array(buf->num_pages, sizeof(struct page *),
+                                   GFP_KERNEL | __GFP_ZERO);
        if (!buf->pages)
                goto fail_pages_array_alloc;
 
        while (num_pages--)
                __free_page(buf->pages[num_pages]);
 fail_pages_alloc:
-       kfree(buf->pages);
+       kvfree(buf->pages);
 fail_pages_array_alloc:
        kfree(buf);
        return ERR_PTR(-ENOMEM);
                sg_free_table(buf->dma_sgt);
                while (--i >= 0)
                        __free_page(buf->pages[i]);
-               kfree(buf->pages);
+               kvfree(buf->pages);
                put_device(buf->dev);
                kfree(buf);
        }