diff options
| author | Kees Cook <kees@kernel.org> | 2026-02-20 23:49:23 -0800 |
|---|---|---|
| committer | Kees Cook <kees@kernel.org> | 2026-02-21 01:02:28 -0800 |
| commit | 69050f8d6d075dc01af7a5f2f550a8067510366f (patch) | |
| tree | bb265f94d9dfa7876c06a5d9f88673d496a15341 /drivers/media | |
| parent | d39a1d7486d98668dd34aaa6732aad7977c45f5a (diff) | |
| download | lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.tar.gz lwn-69050f8d6d075dc01af7a5f2f550a8067510366f.zip | |
treewide: Replace kmalloc with kmalloc_obj for non-scalar types
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:
Single allocations: kmalloc(sizeof(TYPE), ...)
are replaced with: kmalloc_obj(TYPE, ...)
Array allocations: kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with: kmalloc_objs(TYPE, COUNT, ...)
Flex array allocations: kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with: kmalloc_flex(*PTR, FAM, COUNT, ...)
(where TYPE may also be *VAR)
The resulting allocations no longer return "void *", instead returning
"TYPE *".
Signed-off-by: Kees Cook <kees@kernel.org>
Diffstat (limited to 'drivers/media')
490 files changed, 704 insertions, 717 deletions
diff --git a/drivers/media/cec/core/cec-adap.c b/drivers/media/cec/core/cec-adap.c index ba6828ef540e..b81cdf343209 100644 --- a/drivers/media/cec/core/cec-adap.c +++ b/drivers/media/cec/core/cec-adap.c @@ -95,7 +95,7 @@ void cec_queue_event_fh(struct cec_fh *fh, if (ev_idx < CEC_NUM_CORE_EVENTS) entry = &fh->core_events[ev_idx]; else - entry = kmalloc(sizeof(*entry), GFP_KERNEL); + entry = kmalloc_obj(*entry, GFP_KERNEL); if (entry) { if (new_ev->event == CEC_EVENT_LOST_MSGS && fh->queued_events[ev_idx]) { @@ -218,7 +218,7 @@ static void cec_queue_msg_fh(struct cec_fh *fh, const struct cec_msg *msg) struct cec_msg_entry *entry; mutex_lock(&fh->lock); - entry = kmalloc(sizeof(*entry), GFP_KERNEL); + entry = kmalloc_obj(*entry, GFP_KERNEL); if (entry) { entry->msg = *msg; /* Add new msg at the end of the queue */ @@ -922,7 +922,7 @@ int cec_transmit_msg_fh(struct cec_adapter *adap, struct cec_msg *msg, return -EBUSY; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) return -ENOMEM; diff --git a/drivers/media/cec/core/cec-api.c b/drivers/media/cec/core/cec-api.c index 2b50578d107e..c634185a3446 100644 --- a/drivers/media/cec/core/cec-api.c +++ b/drivers/media/cec/core/cec-api.c @@ -555,7 +555,7 @@ static int cec_open(struct inode *inode, struct file *filp) struct cec_devnode *devnode = container_of(inode->i_cdev, struct cec_devnode, cdev); struct cec_adapter *adap = to_cec_adapter(devnode); - struct cec_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); + struct cec_fh *fh = kzalloc_obj(*fh, GFP_KERNEL); /* * Initial events that are automatically sent when the cec device is * opened. diff --git a/drivers/media/cec/core/cec-core.c b/drivers/media/cec/core/cec-core.c index dd6e24a0899b..e6d958662d37 100644 --- a/drivers/media/cec/core/cec-core.c +++ b/drivers/media/cec/core/cec-core.c @@ -237,7 +237,7 @@ struct cec_adapter *cec_allocate_adapter(const struct cec_adap_ops *ops, return ERR_PTR(-EINVAL); if (WARN_ON(!available_las || available_las > CEC_MAX_LOG_ADDRS)) return ERR_PTR(-EINVAL); - adap = kzalloc(sizeof(*adap), GFP_KERNEL); + adap = kzalloc_obj(*adap, GFP_KERNEL); if (!adap) return ERR_PTR(-ENOMEM); strscpy(adap->name, name, sizeof(adap->name)); diff --git a/drivers/media/cec/core/cec-notifier.c b/drivers/media/cec/core/cec-notifier.c index 1fed0b1c71e9..026476ce6bfb 100644 --- a/drivers/media/cec/core/cec-notifier.c +++ b/drivers/media/cec/core/cec-notifier.c @@ -63,7 +63,7 @@ cec_notifier_get_conn(struct device *hdmi_dev, const char *port_name) return n; } } - n = kzalloc(sizeof(*n), GFP_KERNEL); + n = kzalloc_obj(*n, GFP_KERNEL); if (!n) goto unlock; n->hdmi_dev = hdmi_dev; diff --git a/drivers/media/cec/core/cec-pin.c b/drivers/media/cec/core/cec-pin.c index 4d7155281daa..5299d944b526 100644 --- a/drivers/media/cec/core/cec-pin.c +++ b/drivers/media/cec/core/cec-pin.c @@ -1367,7 +1367,7 @@ struct cec_adapter *cec_pin_allocate_adapter(const struct cec_pin_ops *pin_ops, void *priv, const char *name, u32 caps) { struct cec_adapter *adap; - struct cec_pin *pin = kzalloc(sizeof(*pin), GFP_KERNEL); + struct cec_pin *pin = kzalloc_obj(*pin, GFP_KERNEL); if (pin == NULL) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c index bf92576bb2fc..8249d3bb11e4 100644 --- a/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c +++ b/drivers/media/cec/usb/extron-da-hd-4k-plus/extron-da-hd-4k-plus.c @@ -1494,7 +1494,7 @@ static int extron_setup(struct extron *extron) if (vendor_id) caps &= ~CEC_CAP_LOG_ADDRS; - port = kzalloc(sizeof(*port), GFP_KERNEL); + port = kzalloc_obj(*port, GFP_KERNEL); if (!port) return -ENOMEM; @@ -1769,7 +1769,7 @@ static int extron_connect(struct serio *serio, struct serio_driver *drv) manufacturer_name[0] = 0; } - extron = kzalloc(sizeof(*extron), GFP_KERNEL); + extron = kzalloc_obj(*extron, GFP_KERNEL); if (!extron) return -ENOMEM; diff --git a/drivers/media/cec/usb/pulse8/pulse8-cec.c b/drivers/media/cec/usb/pulse8/pulse8-cec.c index 60569f1670fe..d000416d25c4 100644 --- a/drivers/media/cec/usb/pulse8/pulse8-cec.c +++ b/drivers/media/cec/usb/pulse8/pulse8-cec.c @@ -840,7 +840,7 @@ static int pulse8_connect(struct serio *serio, struct serio_driver *drv) struct cec_log_addrs log_addrs = {}; u16 pa = CEC_PHYS_ADDR_INVALID; - pulse8 = kzalloc(sizeof(*pulse8), GFP_KERNEL); + pulse8 = kzalloc_obj(*pulse8, GFP_KERNEL); if (!pulse8) return -ENOMEM; diff --git a/drivers/media/cec/usb/rainshadow/rainshadow-cec.c b/drivers/media/cec/usb/rainshadow/rainshadow-cec.c index 6c0cee4b066f..5457fe240654 100644 --- a/drivers/media/cec/usb/rainshadow/rainshadow-cec.c +++ b/drivers/media/cec/usb/rainshadow/rainshadow-cec.c @@ -313,7 +313,7 @@ static int rain_connect(struct serio *serio, struct serio_driver *drv) struct cec_log_addrs log_addrs = {}; u16 pa = CEC_PHYS_ADDR_INVALID; - rain = kzalloc(sizeof(*rain), GFP_KERNEL); + rain = kzalloc_obj(*rain, GFP_KERNEL); if (!rain) return -ENOMEM; diff --git a/drivers/media/common/b2c2/flexcop.c b/drivers/media/common/b2c2/flexcop.c index 8506de48ba45..88668065a308 100644 --- a/drivers/media/common/b2c2/flexcop.c +++ b/drivers/media/common/b2c2/flexcop.c @@ -214,8 +214,8 @@ void flexcop_reset_block_300(struct flexcop_device *fc) struct flexcop_device *flexcop_device_kmalloc(size_t bus_specific_len) { void *bus; - struct flexcop_device *fc = kzalloc(sizeof(struct flexcop_device), - GFP_KERNEL); + struct flexcop_device *fc = kzalloc_obj(struct flexcop_device, + GFP_KERNEL); if (!fc) { err("no memory"); return NULL; diff --git a/drivers/media/common/cypress_firmware.c b/drivers/media/common/cypress_firmware.c index cdc7050ed3ac..c1c110428928 100644 --- a/drivers/media/common/cypress_firmware.c +++ b/drivers/media/common/cypress_firmware.c @@ -75,7 +75,7 @@ int cypress_load_firmware(struct usb_device *udev, struct hexline *hx; int ret, pos = 0; - hx = kmalloc(sizeof(*hx), GFP_KERNEL); + hx = kmalloc_obj(*hx, GFP_KERNEL); if (!hx) return -ENOMEM; diff --git a/drivers/media/common/saa7146/saa7146_core.c b/drivers/media/common/saa7146/saa7146_core.c index 27c53eed8fe3..fc0f88b16dc3 100644 --- a/drivers/media/common/saa7146/saa7146_core.c +++ b/drivers/media/common/saa7146/saa7146_core.c @@ -141,7 +141,7 @@ static struct scatterlist* vmalloc_to_sg(unsigned char *virt, int nr_pages) struct page *pg; int i; - sglist = kmalloc_array(nr_pages, sizeof(struct scatterlist), GFP_KERNEL); + sglist = kmalloc_objs(struct scatterlist, nr_pages, GFP_KERNEL); if (NULL == sglist) return NULL; sg_init_table(sglist, nr_pages); @@ -334,7 +334,7 @@ static int saa7146_init_one(struct pci_dev *pci, const struct pci_device_id *ent int err = -ENOMEM; /* clear out mem for sure */ - dev = kzalloc(sizeof(struct saa7146_dev), GFP_KERNEL); + dev = kzalloc_obj(struct saa7146_dev, GFP_KERNEL); if (!dev) { ERR("out of memory\n"); goto out; diff --git a/drivers/media/common/saa7146/saa7146_fops.c b/drivers/media/common/saa7146/saa7146_fops.c index a9e3bad76d54..f448c0a0e05f 100644 --- a/drivers/media/common/saa7146/saa7146_fops.c +++ b/drivers/media/common/saa7146/saa7146_fops.c @@ -266,7 +266,7 @@ int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv) } dev->v4l2_dev.ctrl_handler = hdl; - vv = kzalloc(sizeof(struct saa7146_vv), GFP_KERNEL); + vv = kzalloc_obj(struct saa7146_vv, GFP_KERNEL); if (vv == NULL) { ERR("out of memory. aborting.\n"); v4l2_ctrl_handler_free(hdl); diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index 3732367e0c62..489a8dd0a161 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -439,7 +439,7 @@ static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) return entry; } } - entry = kmalloc(sizeof(*entry), GFP_KERNEL); + entry = kmalloc_obj(*entry, GFP_KERNEL); if (entry) { entry->mode = default_mode; strscpy(entry->devpath, devpath, sizeof(entry->devpath)); @@ -528,7 +528,7 @@ int smscore_register_hotplug(hotplug_t hotplug) int rc = 0; mutex_lock(&g_smscore_deviceslock); - notifyee = kmalloc(sizeof(*notifyee), GFP_KERNEL); + notifyee = kmalloc_obj(*notifyee, GFP_KERNEL); if (notifyee) { /* now notify callback about existing devices */ first = &g_smscore_devices; @@ -617,7 +617,7 @@ smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, { struct smscore_buffer_t *cb; - cb = kzalloc(sizeof(*cb), GFP_KERNEL); + cb = kzalloc_obj(*cb, GFP_KERNEL); if (!cb) return NULL; @@ -647,7 +647,7 @@ int smscore_register_device(struct smsdevice_params_t *params, struct smscore_device_t *dev; u8 *buffer; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; @@ -1678,7 +1678,7 @@ static int smscore_validate_client(struct smscore_device_t *coredev, pr_err("The msg ID already registered to another client.\n"); return -EEXIST; } - listentry = kzalloc(sizeof(*listentry), GFP_KERNEL); + listentry = kzalloc_obj(*listentry, GFP_KERNEL); if (!listentry) return -ENOMEM; @@ -1715,7 +1715,7 @@ int smscore_register_client(struct smscore_device_t *coredev, return -EEXIST; } - newclient = kzalloc(sizeof(*newclient), GFP_KERNEL); + newclient = kzalloc_obj(*newclient, GFP_KERNEL); if (!newclient) return -ENOMEM; diff --git a/drivers/media/common/siano/smsdvb-debugfs.c b/drivers/media/common/siano/smsdvb-debugfs.c index d14ba271db50..e5fbc08d4192 100644 --- a/drivers/media/common/siano/smsdvb-debugfs.c +++ b/drivers/media/common/siano/smsdvb-debugfs.c @@ -358,7 +358,7 @@ int smsdvb_debugfs_create(struct smsdvb_client_t *client) if (!smsdvb_debugfs_usb_root || !coredev->is_usb_device) return -ENODEV; - debug_data = kzalloc(sizeof(*client->debug_data), GFP_KERNEL); + debug_data = kzalloc_obj(*client->debug_data, GFP_KERNEL); if (!debug_data) return -ENOMEM; diff --git a/drivers/media/common/siano/smsdvb-main.c b/drivers/media/common/siano/smsdvb-main.c index 9b1a650ed055..f49845a266e5 100644 --- a/drivers/media/common/siano/smsdvb-main.c +++ b/drivers/media/common/siano/smsdvb-main.c @@ -1110,7 +1110,7 @@ static int smsdvb_hotplug(struct smscore_device_t *coredev, /* device removal handled by onremove callback */ if (!arrival) return 0; - client = kzalloc(sizeof(struct smsdvb_client_t), GFP_KERNEL); + client = kzalloc_obj(struct smsdvb_client_t, GFP_KERNEL); if (!client) return -ENOMEM; diff --git a/drivers/media/common/videobuf2/videobuf2-core.c b/drivers/media/common/videobuf2/videobuf2-core.c index 2d1f253b4929..a70181f8d9d9 100644 --- a/drivers/media/common/videobuf2/videobuf2-core.c +++ b/drivers/media/common/videobuf2/videobuf2-core.c @@ -841,7 +841,7 @@ static bool verify_coherency_flags(struct vb2_queue *q, bool non_coherent_mem) static int vb2_core_allocated_buffers_storage(struct vb2_queue *q) { if (!q->bufs) - q->bufs = kcalloc(q->max_num_buffers, sizeof(*q->bufs), GFP_KERNEL); + q->bufs = kzalloc_objs(*q->bufs, q->max_num_buffers, GFP_KERNEL); if (!q->bufs) return -ENOMEM; @@ -2861,7 +2861,7 @@ static int __vb2_init_fileio(struct vb2_queue *q, int read) (read) ? "read" : "write", q->min_reqbufs_allocation, q->fileio_read_once, q->fileio_write_immediately); - fileio = kzalloc(sizeof(*fileio), GFP_KERNEL); + fileio = kzalloc_obj(*fileio, GFP_KERNEL); if (fileio == NULL) return -ENOMEM; @@ -3256,7 +3256,7 @@ int vb2_thread_start(struct vb2_queue *q, vb2_thread_fnc fnc, void *priv, if (WARN_ON(q->fileio)) return -EBUSY; - threadio = kzalloc(sizeof(*threadio), GFP_KERNEL); + threadio = kzalloc_obj(*threadio, GFP_KERNEL); if (threadio == NULL) return -ENOMEM; threadio->fnc = fnc; diff --git a/drivers/media/common/videobuf2/videobuf2-dma-contig.c b/drivers/media/common/videobuf2/videobuf2-dma-contig.c index 7123c5fae92c..983de3b99acb 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-contig.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-contig.c @@ -238,7 +238,7 @@ static void *vb2_dc_alloc(struct vb2_buffer *vb, if (WARN_ON(!dev)) return ERR_PTR(-EINVAL); - buf = kzalloc(sizeof *buf, GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -325,7 +325,7 @@ static int vb2_dc_dmabuf_ops_attach(struct dma_buf *dbuf, struct vb2_dc_buf *buf = dbuf->priv; int ret; - attach = kzalloc(sizeof(*attach), GFP_KERNEL); + attach = kzalloc_obj(*attach, GFP_KERNEL); if (!attach) return -ENOMEM; @@ -479,7 +479,7 @@ static struct sg_table *vb2_dc_get_base_sgt(struct vb2_dc_buf *buf) if (buf->non_coherent_mem) return buf->dma_sgt; - sgt = kmalloc(sizeof(*sgt), GFP_KERNEL); + sgt = kmalloc_obj(*sgt, GFP_KERNEL); if (!sgt) { dev_err(buf->dev, "failed to alloc sg table\n"); return NULL; @@ -587,7 +587,7 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev, if (WARN_ON(!dev)) return ERR_PTR(-EINVAL); - buf = kzalloc(sizeof *buf, GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -624,7 +624,7 @@ static void *vb2_dc_get_userptr(struct vb2_buffer *vb, struct device *dev, goto out; } - sgt = kzalloc(sizeof(*sgt), GFP_KERNEL); + sgt = kzalloc_obj(*sgt, GFP_KERNEL); if (!sgt) { pr_err("failed to allocate sg table\n"); ret = -ENOMEM; @@ -779,7 +779,7 @@ static void *vb2_dc_attach_dmabuf(struct vb2_buffer *vb, struct device *dev, if (WARN_ON(!dev)) return ERR_PTR(-EINVAL); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/common/videobuf2/videobuf2-dma-sg.c b/drivers/media/common/videobuf2/videobuf2-dma-sg.c index b3bf2173c14e..76a9301fb85b 100644 --- a/drivers/media/common/videobuf2/videobuf2-dma-sg.c +++ b/drivers/media/common/videobuf2/videobuf2-dma-sg.c @@ -109,7 +109,7 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev, if (WARN_ON(!dev) || WARN_ON(!size)) return ERR_PTR(-EINVAL); - buf = kzalloc(sizeof *buf, GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -126,7 +126,7 @@ static void *vb2_dma_sg_alloc(struct vb2_buffer *vb, struct device *dev, * there is no memory consistency guarantee, hence dma-sg ignores DMA * attributes passed from the upper layer. */ - buf->pages = kvcalloc(buf->num_pages, sizeof(struct page *), GFP_KERNEL); + buf->pages = kvzalloc_objs(struct page *, buf->num_pages, GFP_KERNEL); if (!buf->pages) goto fail_pages_array_alloc; @@ -230,7 +230,7 @@ static void *vb2_dma_sg_get_userptr(struct vb2_buffer *vb, struct device *dev, if (WARN_ON(!dev)) return ERR_PTR(-EINVAL); - buf = kzalloc(sizeof *buf, GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -375,7 +375,7 @@ static int vb2_dma_sg_dmabuf_ops_attach(struct dma_buf *dbuf, struct vb2_dma_sg_buf *buf = dbuf->priv; int ret; - attach = kzalloc(sizeof(*attach), GFP_KERNEL); + attach = kzalloc_obj(*attach, GFP_KERNEL); if (!attach) return -ENOMEM; @@ -626,7 +626,7 @@ static void *vb2_dma_sg_attach_dmabuf(struct vb2_buffer *vb, struct device *dev, if (dbuf->size < size) return ERR_PTR(-EFAULT); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/common/videobuf2/videobuf2-dvb.c b/drivers/media/common/videobuf2/videobuf2-dvb.c index 3746bf6d1c15..e37dd9007b19 100644 --- a/drivers/media/common/videobuf2/videobuf2-dvb.c +++ b/drivers/media/common/videobuf2/videobuf2-dvb.c @@ -299,7 +299,7 @@ struct vb2_dvb_frontend *vb2_dvb_alloc_frontend( { struct vb2_dvb_frontend *fe; - fe = kzalloc(sizeof(struct vb2_dvb_frontend), GFP_KERNEL); + fe = kzalloc_obj(struct vb2_dvb_frontend, GFP_KERNEL); if (fe == NULL) return NULL; diff --git a/drivers/media/common/videobuf2/videobuf2-vmalloc.c b/drivers/media/common/videobuf2/videobuf2-vmalloc.c index 3f777068cd34..a410e9078626 100644 --- a/drivers/media/common/videobuf2/videobuf2-vmalloc.c +++ b/drivers/media/common/videobuf2/videobuf2-vmalloc.c @@ -39,7 +39,7 @@ static void *vb2_vmalloc_alloc(struct vb2_buffer *vb, struct device *dev, { struct vb2_vmalloc_buf *buf; - buf = kzalloc(sizeof(*buf), GFP_KERNEL | vb->vb2_queue->gfp_flags); + buf = kzalloc_obj(*buf, GFP_KERNEL | vb->vb2_queue->gfp_flags); if (!buf) return ERR_PTR(-ENOMEM); @@ -78,7 +78,7 @@ static void *vb2_vmalloc_get_userptr(struct vb2_buffer *vb, struct device *dev, int n_pages, offset, i; int ret = -ENOMEM; - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); @@ -221,7 +221,7 @@ static int vb2_vmalloc_dmabuf_ops_attach(struct dma_buf *dbuf, int ret; int i; - attach = kzalloc(sizeof(*attach), GFP_KERNEL); + attach = kzalloc_obj(*attach, GFP_KERNEL); if (!attach) return -ENOMEM; @@ -409,7 +409,7 @@ static void *vb2_vmalloc_attach_dmabuf(struct vb2_buffer *vb, if (dbuf->size < size) return ERR_PTR(-EFAULT); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/dvb-core/dmxdev.c b/drivers/media/dvb-core/dmxdev.c index c946c8ea6e39..254d56059863 100644 --- a/drivers/media/dvb-core/dmxdev.c +++ b/drivers/media/dvb-core/dmxdev.c @@ -892,7 +892,7 @@ static int dvb_dmxdev_add_pid(struct dmxdev *dmxdev, (!list_empty(&filter->feed.ts))) return -EINVAL; - feed = kzalloc(sizeof(struct dmxdev_feed), GFP_KERNEL); + feed = kzalloc_obj(struct dmxdev_feed, GFP_KERNEL); if (feed == NULL) return -ENOMEM; diff --git a/drivers/media/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb-core/dvb_ca_en50221.c index 7b591aa1179f..d25d4522240a 100644 --- a/drivers/media/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb-core/dvb_ca_en50221.c @@ -1880,7 +1880,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, return -EINVAL; /* initialise the system data */ - ca = kzalloc(sizeof(*ca), GFP_KERNEL); + ca = kzalloc_obj(*ca, GFP_KERNEL); if (!ca) { ret = -ENOMEM; goto exit; @@ -1889,8 +1889,7 @@ int dvb_ca_en50221_init(struct dvb_adapter *dvb_adapter, ca->pub = pubca; ca->flags = flags; ca->slot_count = slot_count; - ca->slot_info = kcalloc(slot_count, sizeof(struct dvb_ca_slot), - GFP_KERNEL); + ca->slot_info = kzalloc_objs(struct dvb_ca_slot, slot_count, GFP_KERNEL); if (!ca->slot_info) { ret = -ENOMEM; goto free_ca; diff --git a/drivers/media/dvb-core/dvb_frontend.c b/drivers/media/dvb-core/dvb_frontend.c index a05aa271a1ba..6ba5857d280f 100644 --- a/drivers/media/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb-core/dvb_frontend.c @@ -3021,7 +3021,7 @@ int dvb_register_frontend(struct dvb_adapter *dvb, if (mutex_lock_interruptible(&frontend_mutex)) return -ERESTARTSYS; - fe->frontend_priv = kzalloc(sizeof(struct dvb_frontend_private), GFP_KERNEL); + fe->frontend_priv = kzalloc_obj(struct dvb_frontend_private, GFP_KERNEL); if (!fe->frontend_priv) { mutex_unlock(&frontend_mutex); return -ENOMEM; diff --git a/drivers/media/dvb-core/dvbdev.c b/drivers/media/dvb-core/dvbdev.c index 8b980d371a45..00476e7ee048 100644 --- a/drivers/media/dvb-core/dvbdev.c +++ b/drivers/media/dvb-core/dvbdev.c @@ -251,13 +251,13 @@ static int dvb_create_tsout_entity(struct dvb_device *dvbdev, { int i; - dvbdev->tsout_pads = kcalloc(npads, sizeof(*dvbdev->tsout_pads), - GFP_KERNEL); + dvbdev->tsout_pads = kzalloc_objs(*dvbdev->tsout_pads, npads, + GFP_KERNEL); if (!dvbdev->tsout_pads) return -ENOMEM; - dvbdev->tsout_entity = kcalloc(npads, sizeof(*dvbdev->tsout_entity), - GFP_KERNEL); + dvbdev->tsout_entity = kzalloc_objs(*dvbdev->tsout_entity, npads, + GFP_KERNEL); if (!dvbdev->tsout_entity) return -ENOMEM; @@ -328,15 +328,14 @@ static int dvb_create_media_entity(struct dvb_device *dvbdev, return 0; } - dvbdev->entity = kzalloc(sizeof(*dvbdev->entity), GFP_KERNEL); + dvbdev->entity = kzalloc_obj(*dvbdev->entity, GFP_KERNEL); if (!dvbdev->entity) return -ENOMEM; dvbdev->entity->name = dvbdev->name; if (npads) { - dvbdev->pads = kcalloc(npads, sizeof(*dvbdev->pads), - GFP_KERNEL); + dvbdev->pads = kzalloc_objs(*dvbdev->pads, npads, GFP_KERNEL); if (!dvbdev->pads) { kfree(dvbdev->entity); dvbdev->entity = NULL; @@ -472,7 +471,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, return -ENFILE; } - *pdvbdev = dvbdev = kzalloc(sizeof(*dvbdev), GFP_KERNEL); + *pdvbdev = dvbdev = kzalloc_obj(*dvbdev, GFP_KERNEL); if (!dvbdev) { mutex_unlock(&dvbdev_register_lock); return -ENOMEM; @@ -500,7 +499,7 @@ int dvb_register_device(struct dvb_adapter *adap, struct dvb_device **pdvbdev, return -ENOMEM; } - new_node = kzalloc(sizeof(*new_node), GFP_KERNEL); + new_node = kzalloc_obj(*new_node, GFP_KERNEL); if (!new_node) { kfree(dvbdevfops); kfree(dvbdev); @@ -712,12 +711,12 @@ int dvb_create_media_graph(struct dvb_adapter *adap, demod = NULL; if (create_rf_connector) { - conn = kzalloc(sizeof(*conn), GFP_KERNEL); + conn = kzalloc_obj(*conn, GFP_KERNEL); if (!conn) return -ENOMEM; adap->conn = conn; - adap->conn_pads = kzalloc(sizeof(*adap->conn_pads), GFP_KERNEL); + adap->conn_pads = kzalloc_obj(*adap->conn_pads, GFP_KERNEL); if (!adap->conn_pads) return -ENOMEM; @@ -1027,7 +1026,7 @@ struct i2c_client *dvb_module_probe(const char *module_name, struct i2c_client *client; struct i2c_board_info *board_info; - board_info = kzalloc(sizeof(*board_info), GFP_KERNEL); + board_info = kzalloc_obj(*board_info, GFP_KERNEL); if (!board_info) return NULL; diff --git a/drivers/media/dvb-frontends/a8293.c b/drivers/media/dvb-frontends/a8293.c index bf2773c5b97a..c1eeed1d08e6 100644 --- a/drivers/media/dvb-frontends/a8293.c +++ b/drivers/media/dvb-frontends/a8293.c @@ -218,7 +218,7 @@ static int a8293_probe(struct i2c_client *client) int ret; u8 buf[2]; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/af9013.c b/drivers/media/dvb-frontends/af9013.c index befd6a4eafd9..d004ec9e94f0 100644 --- a/drivers/media/dvb-frontends/af9013.c +++ b/drivers/media/dvb-frontends/af9013.c @@ -1447,7 +1447,7 @@ static int af9013_probe(struct i2c_client *client) .val_bits = 8, }; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/af9033.c b/drivers/media/dvb-frontends/af9033.c index eed2ea4da8fa..584cc0405e4a 100644 --- a/drivers/media/dvb-frontends/af9033.c +++ b/drivers/media/dvb-frontends/af9033.c @@ -1062,7 +1062,7 @@ static int af9033_probe(struct i2c_client *client) }; /* Allocate memory for the internal state */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/as102_fe.c b/drivers/media/dvb-frontends/as102_fe.c index bc72d954dc1f..5b17d0b6f3ea 100644 --- a/drivers/media/dvb-frontends/as102_fe.c +++ b/drivers/media/dvb-frontends/as102_fe.c @@ -447,7 +447,7 @@ struct dvb_frontend *as102_attach(const char *name, struct as102_state *state; struct dvb_frontend *fe; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/ascot2e.c b/drivers/media/dvb-frontends/ascot2e.c index cf8e5f1bd101..0d28a3422cae 100644 --- a/drivers/media/dvb-frontends/ascot2e.c +++ b/drivers/media/dvb-frontends/ascot2e.c @@ -477,7 +477,7 @@ struct dvb_frontend *ascot2e_attach(struct dvb_frontend *fe, u8 data[4]; struct ascot2e_priv *priv = NULL; - priv = kzalloc(sizeof(struct ascot2e_priv), GFP_KERNEL); + priv = kzalloc_obj(struct ascot2e_priv, GFP_KERNEL); if (priv == NULL) return NULL; priv->i2c_address = (config->i2c_address >> 1); diff --git a/drivers/media/dvb-frontends/atbm8830.c b/drivers/media/dvb-frontends/atbm8830.c index 778c865085bf..2b9dbd748ebc 100644 --- a/drivers/media/dvb-frontends/atbm8830.c +++ b/drivers/media/dvb-frontends/atbm8830.c @@ -458,7 +458,7 @@ struct dvb_frontend *atbm8830_attach(const struct atbm8830_config *config, if (config == NULL || i2c == NULL) return NULL; - priv = kzalloc(sizeof(struct atbm_state), GFP_KERNEL); + priv = kzalloc_obj(struct atbm_state, GFP_KERNEL); if (priv == NULL) goto error_out; diff --git a/drivers/media/dvb-frontends/bcm3510.c b/drivers/media/dvb-frontends/bcm3510.c index d935fb10e620..50f43f9c7aef 100644 --- a/drivers/media/dvb-frontends/bcm3510.c +++ b/drivers/media/dvb-frontends/bcm3510.c @@ -800,7 +800,7 @@ struct dvb_frontend* bcm3510_attach(const struct bcm3510_config *config, bcm3510_register_value v; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct bcm3510_state), GFP_KERNEL); + state = kzalloc_obj(struct bcm3510_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/cx22700.c b/drivers/media/dvb-frontends/cx22700.c index 1d04c0a652b2..9f36c837fd66 100644 --- a/drivers/media/dvb-frontends/cx22700.c +++ b/drivers/media/dvb-frontends/cx22700.c @@ -376,7 +376,7 @@ struct dvb_frontend* cx22700_attach(const struct cx22700_config* config, struct cx22700_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct cx22700_state), GFP_KERNEL); + state = kzalloc_obj(struct cx22700_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/cx22702.c b/drivers/media/dvb-frontends/cx22702.c index 61ad34b7004b..acdc8712d343 100644 --- a/drivers/media/dvb-frontends/cx22702.c +++ b/drivers/media/dvb-frontends/cx22702.c @@ -582,7 +582,7 @@ struct dvb_frontend *cx22702_attach(const struct cx22702_config *config, struct cx22702_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct cx22702_state), GFP_KERNEL); + state = kzalloc_obj(struct cx22702_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/cx24110.c b/drivers/media/dvb-frontends/cx24110.c index 65dd9b72ea55..a413dd023aa9 100644 --- a/drivers/media/dvb-frontends/cx24110.c +++ b/drivers/media/dvb-frontends/cx24110.c @@ -588,7 +588,7 @@ struct dvb_frontend* cx24110_attach(const struct cx24110_config* config, int ret; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct cx24110_state), GFP_KERNEL); + state = kzalloc_obj(struct cx24110_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/cx24113.c b/drivers/media/dvb-frontends/cx24113.c index 203cb6b3f941..450e9d02e950 100644 --- a/drivers/media/dvb-frontends/cx24113.c +++ b/drivers/media/dvb-frontends/cx24113.c @@ -542,7 +542,7 @@ struct dvb_frontend *cx24113_attach(struct dvb_frontend *fe, const struct cx24113_config *config, struct i2c_adapter *i2c) { /* allocate memory for the internal state */ - struct cx24113_state *state = kzalloc(sizeof(*state), GFP_KERNEL); + struct cx24113_state *state = kzalloc_obj(*state, GFP_KERNEL); int rc; if (!state) diff --git a/drivers/media/dvb-frontends/cx24116.c b/drivers/media/dvb-frontends/cx24116.c index f5dd3a81725a..f7c2d7b165ce 100644 --- a/drivers/media/dvb-frontends/cx24116.c +++ b/drivers/media/dvb-frontends/cx24116.c @@ -1116,7 +1116,7 @@ struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, dprintk("%s\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/cx24117.c b/drivers/media/dvb-frontends/cx24117.c index 75fc7ad263d0..99555db3c537 100644 --- a/drivers/media/dvb-frontends/cx24117.c +++ b/drivers/media/dvb-frontends/cx24117.c @@ -1184,7 +1184,7 @@ struct dvb_frontend *cx24117_attach(const struct cx24117_config *config, } /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct cx24117_state), GFP_KERNEL); + state = kzalloc_obj(struct cx24117_state, GFP_KERNEL); if (state == NULL) goto error2; diff --git a/drivers/media/dvb-frontends/cx24120.c b/drivers/media/dvb-frontends/cx24120.c index 44515fdbe91d..2602fe350d35 100644 --- a/drivers/media/dvb-frontends/cx24120.c +++ b/drivers/media/dvb-frontends/cx24120.c @@ -268,7 +268,7 @@ struct dvb_frontend *cx24120_attach(const struct cx24120_config *config, int demod_rev; info("Conexant cx24120/cx24118 - DVBS/S2 Satellite demod/tuner\n"); - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) { err("Unable to allocate memory for cx24120_state\n"); goto error; diff --git a/drivers/media/dvb-frontends/cx24123.c b/drivers/media/dvb-frontends/cx24123.c index 539889e638cc..ecc1a017cbe1 100644 --- a/drivers/media/dvb-frontends/cx24123.c +++ b/drivers/media/dvb-frontends/cx24123.c @@ -1043,7 +1043,7 @@ struct dvb_frontend *cx24123_attach(const struct cx24123_config *config, { /* allocate memory for the internal state */ struct cx24123_state *state = - kzalloc(sizeof(struct cx24123_state), GFP_KERNEL); + kzalloc_obj(struct cx24123_state, GFP_KERNEL); dprintk("\n"); if (state == NULL) { diff --git a/drivers/media/dvb-frontends/cxd2099.c b/drivers/media/dvb-frontends/cxd2099.c index 5e6e18819a0d..80ca00f22d07 100644 --- a/drivers/media/dvb-frontends/cxd2099.c +++ b/drivers/media/dvb-frontends/cxd2099.c @@ -609,7 +609,7 @@ static int cxd2099_probe(struct i2c_client *client) unsigned int val; int ret; - ci = kzalloc(sizeof(*ci), GFP_KERNEL); + ci = kzalloc_obj(*ci, GFP_KERNEL); if (!ci) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/cxd2820r_core.c b/drivers/media/dvb-frontends/cxd2820r_core.c index 5aa3d45a691a..ed3f535db949 100644 --- a/drivers/media/dvb-frontends/cxd2820r_core.c +++ b/drivers/media/dvb-frontends/cxd2820r_core.c @@ -594,7 +594,7 @@ static int cxd2820r_probe(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = kzalloc_obj(*priv, GFP_KERNEL); if (!priv) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/cxd2841er.c b/drivers/media/dvb-frontends/cxd2841er.c index 8fcb4417ba22..db58803c85df 100644 --- a/drivers/media/dvb-frontends/cxd2841er.c +++ b/drivers/media/dvb-frontends/cxd2841er.c @@ -3844,7 +3844,7 @@ static struct dvb_frontend *cxd2841er_attach(struct cxd2841er_config *cfg, struct cxd2841er_priv *priv = NULL; /* allocate memory for the internal state */ - priv = kzalloc(sizeof(struct cxd2841er_priv), GFP_KERNEL); + priv = kzalloc_obj(struct cxd2841er_priv, GFP_KERNEL); if (!priv) return NULL; priv->i2c = i2c; diff --git a/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c index a06d8368ca79..1a1ed41f7555 100644 --- a/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c +++ b/drivers/media/dvb-frontends/cxd2880/cxd2880_top.c @@ -1887,7 +1887,7 @@ struct dvb_frontend *cxd2880_attach(struct dvb_frontend *fe, return NULL; } - priv = kzalloc(sizeof(struct cxd2880_priv), GFP_KERNEL); + priv = kzalloc_obj(struct cxd2880_priv, GFP_KERNEL); if (!priv) return NULL; diff --git a/drivers/media/dvb-frontends/dib0070.c b/drivers/media/dvb-frontends/dib0070.c index 9a8e7cdd2a24..de91a6e497a7 100644 --- a/drivers/media/dvb-frontends/dib0070.c +++ b/drivers/media/dvb-frontends/dib0070.c @@ -738,7 +738,8 @@ static const struct dvb_tuner_ops dib0070_ops = { struct dvb_frontend *dib0070_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct dib0070_config *cfg) { - struct dib0070_state *state = kzalloc(sizeof(struct dib0070_state), GFP_KERNEL); + struct dib0070_state *state = kzalloc_obj(struct dib0070_state, + GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/dib0090.c b/drivers/media/dvb-frontends/dib0090.c index 6cbbb351d545..f11083a955ec 100644 --- a/drivers/media/dvb-frontends/dib0090.c +++ b/drivers/media/dvb-frontends/dib0090.c @@ -2606,7 +2606,7 @@ static const struct dib0090_wbd_slope dib0090_wbd_table_default[] = { struct dvb_frontend *dib0090_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config) { - struct dib0090_state *st = kzalloc(sizeof(struct dib0090_state), GFP_KERNEL); + struct dib0090_state *st = kzalloc_obj(struct dib0090_state, GFP_KERNEL); if (st == NULL) return NULL; @@ -2638,7 +2638,8 @@ EXPORT_SYMBOL_GPL(dib0090_register); struct dvb_frontend *dib0090_fw_register(struct dvb_frontend *fe, struct i2c_adapter *i2c, const struct dib0090_config *config) { - struct dib0090_fw_state *st = kzalloc(sizeof(struct dib0090_fw_state), GFP_KERNEL); + struct dib0090_fw_state *st = kzalloc_obj(struct dib0090_fw_state, + GFP_KERNEL); if (st == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/dib3000mb.c b/drivers/media/dvb-frontends/dib3000mb.c index 63bc7b74bc8b..ab7046a4ff96 100644 --- a/drivers/media/dvb-frontends/dib3000mb.c +++ b/drivers/media/dvb-frontends/dib3000mb.c @@ -746,7 +746,7 @@ struct dvb_frontend* dib3000mb_attach(const struct dib3000_config* config, struct dib3000_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct dib3000_state), GFP_KERNEL); + state = kzalloc_obj(struct dib3000_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/dib3000mc.c b/drivers/media/dvb-frontends/dib3000mc.c index c2fca8289aba..12ee8a5d3b6e 100644 --- a/drivers/media/dvb-frontends/dib3000mc.c +++ b/drivers/media/dvb-frontends/dib3000mc.c @@ -861,7 +861,7 @@ int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 defa static const u8 DIB3000MC_I2C_ADDRESS[] = { 20, 22, 24, 26 }; - dmcst = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); + dmcst = kzalloc_obj(struct dib3000mc_state, GFP_KERNEL); if (dmcst == NULL) return -ENOMEM; @@ -910,7 +910,7 @@ struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr { struct dvb_frontend *demod; struct dib3000mc_state *st; - st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL); + st = kzalloc_obj(struct dib3000mc_state, GFP_KERNEL); if (st == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/dib7000m.c b/drivers/media/dvb-frontends/dib7000m.c index fdb22f32e3a1..ffbc313915ed 100644 --- a/drivers/media/dvb-frontends/dib7000m.c +++ b/drivers/media/dvb-frontends/dib7000m.c @@ -1403,7 +1403,7 @@ struct dvb_frontend * dib7000m_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, { struct dvb_frontend *demod; struct dib7000m_state *st; - st = kzalloc(sizeof(struct dib7000m_state), GFP_KERNEL); + st = kzalloc_obj(struct dib7000m_state, GFP_KERNEL); if (st == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/dib7000p.c b/drivers/media/dvb-frontends/dib7000p.c index 7d3a994b7cc4..2d0c85fb11a0 100644 --- a/drivers/media/dvb-frontends/dib7000p.c +++ b/drivers/media/dvb-frontends/dib7000p.c @@ -2081,7 +2081,7 @@ static int dib7000p_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u int k = 0; u8 new_addr = 0; - dpst = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL); + dpst = kzalloc_obj(struct dib7000p_state, GFP_KERNEL); if (!dpst) return -ENOMEM; @@ -2741,7 +2741,7 @@ static struct dvb_frontend *dib7000p_init(struct i2c_adapter *i2c_adap, u8 i2c_a { struct dvb_frontend *demod; struct dib7000p_state *st; - st = kzalloc(sizeof(struct dib7000p_state), GFP_KERNEL); + st = kzalloc_obj(struct dib7000p_state, GFP_KERNEL); if (st == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/dib8000.c b/drivers/media/dvb-frontends/dib8000.c index d90f1b0b2051..2266178f0a22 100644 --- a/drivers/media/dvb-frontends/dib8000.c +++ b/drivers/media/dvb-frontends/dib8000.c @@ -4307,7 +4307,7 @@ static int dib8000_i2c_enumeration(struct i2c_adapter *host, int no_of_demods, ret = -ENOMEM; goto error_memory_read; } - client.i2c_buffer_lock = kzalloc(sizeof(struct mutex), GFP_KERNEL); + client.i2c_buffer_lock = kzalloc_obj(struct mutex, GFP_KERNEL); if (!client.i2c_buffer_lock) { dprintk("%s: not enough memory\n", __func__); ret = -ENOMEM; @@ -4448,10 +4448,10 @@ static struct dvb_frontend *dib8000_init(struct i2c_adapter *i2c_adap, u8 i2c_ad dprintk("dib8000_init\n"); - state = kzalloc(sizeof(struct dib8000_state), GFP_KERNEL); + state = kzalloc_obj(struct dib8000_state, GFP_KERNEL); if (state == NULL) return NULL; - fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL); + fe = kzalloc_obj(struct dvb_frontend, GFP_KERNEL); if (fe == NULL) goto error; diff --git a/drivers/media/dvb-frontends/dib9000.c b/drivers/media/dvb-frontends/dib9000.c index 83cf6eadd49c..b2e5fe1af78a 100644 --- a/drivers/media/dvb-frontends/dib9000.c +++ b/drivers/media/dvb-frontends/dib9000.c @@ -2474,10 +2474,10 @@ struct dvb_frontend *dib9000_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, c { struct dvb_frontend *fe; struct dib9000_state *st; - st = kzalloc(sizeof(struct dib9000_state), GFP_KERNEL); + st = kzalloc_obj(struct dib9000_state, GFP_KERNEL); if (st == NULL) return NULL; - fe = kzalloc(sizeof(struct dvb_frontend), GFP_KERNEL); + fe = kzalloc_obj(struct dvb_frontend, GFP_KERNEL); if (fe == NULL) { kfree(st); return NULL; diff --git a/drivers/media/dvb-frontends/drx39xyj/drxj.c b/drivers/media/dvb-frontends/drx39xyj/drxj.c index 428b31e60874..c7a91f90ed10 100644 --- a/drivers/media/dvb-frontends/drx39xyj/drxj.c +++ b/drivers/media/dvb-frontends/drx39xyj/drxj.c @@ -12276,7 +12276,7 @@ struct dvb_frontend *drx39xxj_attach(struct i2c_adapter *i2c) int result; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct drx39xxj_state), GFP_KERNEL); + state = kzalloc_obj(struct drx39xxj_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/drxd_hard.c b/drivers/media/dvb-frontends/drxd_hard.c index 6a531937f4bb..aefdd620ce2c 100644 --- a/drivers/media/dvb-frontends/drxd_hard.c +++ b/drivers/media/dvb-frontends/drxd_hard.c @@ -2910,7 +2910,7 @@ struct dvb_frontend *drxd_attach(const struct drxd_config *config, { struct drxd_state *state = NULL; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/drxk_hard.c b/drivers/media/dvb-frontends/drxk_hard.c index 9ef367918824..7fb5f46aa1d4 100644 --- a/drivers/media/dvb-frontends/drxk_hard.c +++ b/drivers/media/dvb-frontends/drxk_hard.c @@ -6722,7 +6722,7 @@ struct dvb_frontend *drxk_attach(const struct drxk_config *config, int status; dprintk(1, "\n"); - state = kzalloc(sizeof(struct drxk_state), GFP_KERNEL); + state = kzalloc_obj(struct drxk_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/ds3000.c b/drivers/media/dvb-frontends/ds3000.c index 515aa7c7baf2..d300c357f177 100644 --- a/drivers/media/dvb-frontends/ds3000.c +++ b/drivers/media/dvb-frontends/ds3000.c @@ -827,7 +827,7 @@ struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, dprintk("%s\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/dvb-pll.c b/drivers/media/dvb-frontends/dvb-pll.c index 1775a4aa0a18..078596bd0361 100644 --- a/drivers/media/dvb-frontends/dvb-pll.c +++ b/drivers/media/dvb-frontends/dvb-pll.c @@ -820,7 +820,7 @@ struct dvb_frontend *dvb_pll_attach(struct dvb_frontend *fe, int pll_addr, fe->ops.i2c_gate_ctrl(fe, 0); } - priv = kzalloc(sizeof(struct dvb_pll_priv), GFP_KERNEL); + priv = kzalloc_obj(struct dvb_pll_priv, GFP_KERNEL); if (!priv) goto out; diff --git a/drivers/media/dvb-frontends/dvb_dummy_fe.c b/drivers/media/dvb-frontends/dvb_dummy_fe.c index 9ff1ebaa5e04..9ed03df364d6 100644 --- a/drivers/media/dvb-frontends/dvb_dummy_fe.c +++ b/drivers/media/dvb-frontends/dvb_dummy_fe.c @@ -114,7 +114,7 @@ struct dvb_frontend *dvb_dummy_fe_ofdm_attach(void) struct dvb_dummy_fe_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct dvb_dummy_fe_state, GFP_KERNEL); if (!state) return NULL; @@ -135,7 +135,7 @@ struct dvb_frontend *dvb_dummy_fe_qpsk_attach(void) struct dvb_dummy_fe_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct dvb_dummy_fe_state, GFP_KERNEL); if (!state) return NULL; @@ -156,7 +156,7 @@ struct dvb_frontend *dvb_dummy_fe_qam_attach(void) struct dvb_dummy_fe_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct dvb_dummy_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct dvb_dummy_fe_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/ec100.c b/drivers/media/dvb-frontends/ec100.c index 2ad0a3c2f756..be9ee1c90434 100644 --- a/drivers/media/dvb-frontends/ec100.c +++ b/drivers/media/dvb-frontends/ec100.c @@ -276,7 +276,7 @@ struct dvb_frontend *ec100_attach(const struct ec100_config *config, u8 tmp; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct ec100_state), GFP_KERNEL); + state = kzalloc_obj(struct ec100_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/gp8psk-fe.c b/drivers/media/dvb-frontends/gp8psk-fe.c index ed671e951a17..8893de2758f6 100644 --- a/drivers/media/dvb-frontends/gp8psk-fe.c +++ b/drivers/media/dvb-frontends/gp8psk-fe.c @@ -332,7 +332,7 @@ struct dvb_frontend *gp8psk_fe_attach(const struct gp8psk_fe_ops *ops, return NULL; } - st = kzalloc(sizeof(struct gp8psk_fe_state), GFP_KERNEL); + st = kzalloc_obj(struct gp8psk_fe_state, GFP_KERNEL); if (!st) return NULL; diff --git a/drivers/media/dvb-frontends/helene.c b/drivers/media/dvb-frontends/helene.c index f127adee3ebb..0b68fa8b2664 100644 --- a/drivers/media/dvb-frontends/helene.c +++ b/drivers/media/dvb-frontends/helene.c @@ -997,7 +997,7 @@ struct dvb_frontend *helene_attach_s(struct dvb_frontend *fe, { struct helene_priv *priv = NULL; - priv = kzalloc(sizeof(struct helene_priv), GFP_KERNEL); + priv = kzalloc_obj(struct helene_priv, GFP_KERNEL); if (priv == NULL) return NULL; priv->i2c_address = (config->i2c_address >> 1); @@ -1033,7 +1033,7 @@ struct dvb_frontend *helene_attach(struct dvb_frontend *fe, { struct helene_priv *priv = NULL; - priv = kzalloc(sizeof(struct helene_priv), GFP_KERNEL); + priv = kzalloc_obj(struct helene_priv, GFP_KERNEL); if (priv == NULL) return NULL; priv->i2c_address = (config->i2c_address >> 1); diff --git a/drivers/media/dvb-frontends/horus3a.c b/drivers/media/dvb-frontends/horus3a.c index 0330b78a5b3f..618301eb26aa 100644 --- a/drivers/media/dvb-frontends/horus3a.c +++ b/drivers/media/dvb-frontends/horus3a.c @@ -339,7 +339,7 @@ struct dvb_frontend *horus3a_attach(struct dvb_frontend *fe, u8 buf[3], val; struct horus3a_priv *priv = NULL; - priv = kzalloc(sizeof(struct horus3a_priv), GFP_KERNEL); + priv = kzalloc_obj(struct horus3a_priv, GFP_KERNEL); if (priv == NULL) return NULL; priv->i2c_address = (config->i2c_address >> 1); diff --git a/drivers/media/dvb-frontends/isl6405.c b/drivers/media/dvb-frontends/isl6405.c index 7d28a743f97e..96635db2eabc 100644 --- a/drivers/media/dvb-frontends/isl6405.c +++ b/drivers/media/dvb-frontends/isl6405.c @@ -106,7 +106,7 @@ static void isl6405_release(struct dvb_frontend *fe) struct dvb_frontend *isl6405_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, u8 override_set, u8 override_clear) { - struct isl6405 *isl6405 = kmalloc(sizeof(struct isl6405), GFP_KERNEL); + struct isl6405 *isl6405 = kmalloc_obj(struct isl6405, GFP_KERNEL); if (!isl6405) return NULL; diff --git a/drivers/media/dvb-frontends/isl6421.c b/drivers/media/dvb-frontends/isl6421.c index 2e9f6f12f849..02d9e3b4e91d 100644 --- a/drivers/media/dvb-frontends/isl6421.c +++ b/drivers/media/dvb-frontends/isl6421.c @@ -177,7 +177,7 @@ static void isl6421_release(struct dvb_frontend *fe) struct dvb_frontend *isl6421_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 i2c_addr, u8 override_set, u8 override_clear, bool override_tone) { - struct isl6421 *isl6421 = kmalloc(sizeof(struct isl6421), GFP_KERNEL); + struct isl6421 *isl6421 = kmalloc_obj(struct isl6421, GFP_KERNEL); if (!isl6421) return NULL; diff --git a/drivers/media/dvb-frontends/isl6423.c b/drivers/media/dvb-frontends/isl6423.c index a0d0a3834057..6bffcc381fed 100644 --- a/drivers/media/dvb-frontends/isl6423.c +++ b/drivers/media/dvb-frontends/isl6423.c @@ -258,7 +258,7 @@ struct dvb_frontend *isl6423_attach(struct dvb_frontend *fe, { struct isl6423_dev *isl6423; - isl6423 = kzalloc(sizeof(struct isl6423_dev), GFP_KERNEL); + isl6423 = kzalloc_obj(struct isl6423_dev, GFP_KERNEL); if (!isl6423) return NULL; diff --git a/drivers/media/dvb-frontends/itd1000.c b/drivers/media/dvb-frontends/itd1000.c index f8f362f50e78..6c1863efe227 100644 --- a/drivers/media/dvb-frontends/itd1000.c +++ b/drivers/media/dvb-frontends/itd1000.c @@ -365,7 +365,7 @@ struct dvb_frontend *itd1000_attach(struct dvb_frontend *fe, struct i2c_adapter struct itd1000_state *state = NULL; u8 i = 0; - state = kzalloc(sizeof(struct itd1000_state), GFP_KERNEL); + state = kzalloc_obj(struct itd1000_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/ix2505v.c b/drivers/media/dvb-frontends/ix2505v.c index 3212e333d472..db0875f65de8 100644 --- a/drivers/media/dvb-frontends/ix2505v.c +++ b/drivers/media/dvb-frontends/ix2505v.c @@ -267,7 +267,7 @@ struct dvb_frontend *ix2505v_attach(struct dvb_frontend *fe, goto error; } - state = kzalloc(sizeof(struct ix2505v_state), GFP_KERNEL); + state = kzalloc_obj(struct ix2505v_state, GFP_KERNEL); if (NULL == state) return NULL; diff --git a/drivers/media/dvb-frontends/l64781.c b/drivers/media/dvb-frontends/l64781.c index fe5af2453d55..cfec598001db 100644 --- a/drivers/media/dvb-frontends/l64781.c +++ b/drivers/media/dvb-frontends/l64781.c @@ -497,7 +497,7 @@ struct dvb_frontend* l64781_attach(const struct l64781_config* config, { .addr = config->demod_address, .flags = I2C_M_RD, .buf = b1, .len = 1 } }; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct l64781_state), GFP_KERNEL); + state = kzalloc_obj(struct l64781_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/lg2160.c b/drivers/media/dvb-frontends/lg2160.c index fe700aa56bff..5c9ebfec4524 100644 --- a/drivers/media/dvb-frontends/lg2160.c +++ b/drivers/media/dvb-frontends/lg2160.c @@ -1396,7 +1396,7 @@ struct dvb_frontend *lg2160_attach(const struct lg2160_config *config, i2c_adap ? i2c_adapter_id(i2c_adap) : 0, config ? config->i2c_addr : 0); - state = kzalloc(sizeof(struct lg216x_state), GFP_KERNEL); + state = kzalloc_obj(struct lg216x_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/lgdt3305.c b/drivers/media/dvb-frontends/lgdt3305.c index bdc8311e1c0b..9fcac3361618 100644 --- a/drivers/media/dvb-frontends/lgdt3305.c +++ b/drivers/media/dvb-frontends/lgdt3305.c @@ -1103,7 +1103,7 @@ struct dvb_frontend *lgdt3305_attach(const struct lgdt3305_config *config, i2c_adap ? i2c_adapter_id(i2c_adap) : 0, config ? config->i2c_addr : 0); - state = kzalloc(sizeof(struct lgdt3305_state), GFP_KERNEL); + state = kzalloc_obj(struct lgdt3305_state, GFP_KERNEL); if (state == NULL) goto fail; diff --git a/drivers/media/dvb-frontends/lgdt3306a.c b/drivers/media/dvb-frontends/lgdt3306a.c index 6ab9d4de65ce..a6d885d951a5 100644 --- a/drivers/media/dvb-frontends/lgdt3306a.c +++ b/drivers/media/dvb-frontends/lgdt3306a.c @@ -1802,7 +1802,7 @@ struct dvb_frontend *lgdt3306a_attach(const struct lgdt3306a_config *config, i2c_adap ? i2c_adapter_id(i2c_adap) : 0, config ? config->i2c_addr : 0); - state = kzalloc(sizeof(struct lgdt3306a_state), GFP_KERNEL); + state = kzalloc_obj(struct lgdt3306a_state, GFP_KERNEL); if (state == NULL) goto fail; diff --git a/drivers/media/dvb-frontends/lgdt330x.c b/drivers/media/dvb-frontends/lgdt330x.c index 8c34a5b850bc..43e45c2317e0 100644 --- a/drivers/media/dvb-frontends/lgdt330x.c +++ b/drivers/media/dvb-frontends/lgdt330x.c @@ -863,7 +863,7 @@ static int lgdt330x_probe(struct i2c_client *client) u8 buf[1]; /* Allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) goto error; diff --git a/drivers/media/dvb-frontends/lgs8gl5.c b/drivers/media/dvb-frontends/lgs8gl5.c index 872abb70d1b6..07e422cb53da 100644 --- a/drivers/media/dvb-frontends/lgs8gl5.c +++ b/drivers/media/dvb-frontends/lgs8gl5.c @@ -375,7 +375,7 @@ lgs8gl5_attach(const struct lgs8gl5_config *config, struct i2c_adapter *i2c) dprintk("%s\n", __func__); /* Allocate memory for the internal state */ - state = kzalloc(sizeof(struct lgs8gl5_state), GFP_KERNEL); + state = kzalloc_obj(struct lgs8gl5_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/lgs8gxx.c b/drivers/media/dvb-frontends/lgs8gxx.c index ffaf60e16ecd..8904f767e4ad 100644 --- a/drivers/media/dvb-frontends/lgs8gxx.c +++ b/drivers/media/dvb-frontends/lgs8gxx.c @@ -1012,7 +1012,7 @@ struct dvb_frontend *lgs8gxx_attach(const struct lgs8gxx_config *config, if (config == NULL || i2c == NULL) return NULL; - priv = kzalloc(sizeof(struct lgs8gxx_state), GFP_KERNEL); + priv = kzalloc_obj(struct lgs8gxx_state, GFP_KERNEL); if (priv == NULL) goto error_out; diff --git a/drivers/media/dvb-frontends/lnbh25.c b/drivers/media/dvb-frontends/lnbh25.c index 41bec050642b..e4e4c43465cf 100644 --- a/drivers/media/dvb-frontends/lnbh25.c +++ b/drivers/media/dvb-frontends/lnbh25.c @@ -148,7 +148,7 @@ struct dvb_frontend *lnbh25_attach(struct dvb_frontend *fe, struct lnbh25_priv *priv; dev_dbg(&i2c->dev, "%s()\n", __func__); - priv = kzalloc(sizeof(struct lnbh25_priv), GFP_KERNEL); + priv = kzalloc_obj(struct lnbh25_priv, GFP_KERNEL); if (!priv) return NULL; priv->i2c_address = (cfg->i2c_address >> 1); diff --git a/drivers/media/dvb-frontends/lnbh29.c b/drivers/media/dvb-frontends/lnbh29.c index 410bae099c32..2bb9f8b9d325 100644 --- a/drivers/media/dvb-frontends/lnbh29.c +++ b/drivers/media/dvb-frontends/lnbh29.c @@ -135,7 +135,7 @@ struct dvb_frontend *lnbh29_attach(struct dvb_frontend *fe, { struct lnbh29_priv *priv; - priv = kzalloc(sizeof(*priv), GFP_KERNEL); + priv = kzalloc_obj(*priv, GFP_KERNEL); if (!priv) return NULL; diff --git a/drivers/media/dvb-frontends/lnbp21.c b/drivers/media/dvb-frontends/lnbp21.c index 32593b1f75a3..b68fa4424acd 100644 --- a/drivers/media/dvb-frontends/lnbp21.c +++ b/drivers/media/dvb-frontends/lnbp21.c @@ -113,7 +113,7 @@ static struct dvb_frontend *lnbx2x_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, u8 override_set, u8 override_clear, u8 i2c_addr, u8 config) { - struct lnbp21 *lnbp21 = kmalloc(sizeof(struct lnbp21), GFP_KERNEL); + struct lnbp21 *lnbp21 = kmalloc_obj(struct lnbp21, GFP_KERNEL); if (!lnbp21) return NULL; diff --git a/drivers/media/dvb-frontends/lnbp22.c b/drivers/media/dvb-frontends/lnbp22.c index cb4ea5d3fad4..98e54f74f306 100644 --- a/drivers/media/dvb-frontends/lnbp22.c +++ b/drivers/media/dvb-frontends/lnbp22.c @@ -96,7 +96,7 @@ static void lnbp22_release(struct dvb_frontend *fe) struct dvb_frontend *lnbp22_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c) { - struct lnbp22 *lnbp22 = kmalloc(sizeof(struct lnbp22), GFP_KERNEL); + struct lnbp22 *lnbp22 = kmalloc_obj(struct lnbp22, GFP_KERNEL); if (!lnbp22) return NULL; diff --git a/drivers/media/dvb-frontends/m88ds3103.c b/drivers/media/dvb-frontends/m88ds3103.c index 5a03485686d9..e419551ca46e 100644 --- a/drivers/media/dvb-frontends/m88ds3103.c +++ b/drivers/media/dvb-frontends/m88ds3103.c @@ -1775,7 +1775,7 @@ static int m88ds3103_probe(struct i2c_client *client) int ret; unsigned int utmp; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/m88rs2000.c b/drivers/media/dvb-frontends/m88rs2000.c index 2aa98203cd65..1804c31ebe0f 100644 --- a/drivers/media/dvb-frontends/m88rs2000.c +++ b/drivers/media/dvb-frontends/m88rs2000.c @@ -786,7 +786,7 @@ struct dvb_frontend *m88rs2000_attach(const struct m88rs2000_config *config, struct m88rs2000_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct m88rs2000_state), GFP_KERNEL); + state = kzalloc_obj(struct m88rs2000_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/mb86a16.c b/drivers/media/dvb-frontends/mb86a16.c index 9033e39d75f4..0c9bd4a47be4 100644 --- a/drivers/media/dvb-frontends/mb86a16.c +++ b/drivers/media/dvb-frontends/mb86a16.c @@ -1833,7 +1833,7 @@ struct dvb_frontend *mb86a16_attach(const struct mb86a16_config *config, u8 dev_id = 0; struct mb86a16_state *state = NULL; - state = kmalloc(sizeof(struct mb86a16_state), GFP_KERNEL); + state = kmalloc_obj(struct mb86a16_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/mb86a20s.c b/drivers/media/dvb-frontends/mb86a20s.c index f8e4bbee5bd5..eb596d3b9da5 100644 --- a/drivers/media/dvb-frontends/mb86a20s.c +++ b/drivers/media/dvb-frontends/mb86a20s.c @@ -2052,7 +2052,7 @@ struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, dev_dbg(&i2c->dev, "%s called.\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/mn88472.c b/drivers/media/dvb-frontends/mn88472.c index 729751671c3d..ce3ae7d8d13f 100644 --- a/drivers/media/dvb-frontends/mn88472.c +++ b/drivers/media/dvb-frontends/mn88472.c @@ -586,7 +586,7 @@ static int mn88472_probe(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/mn88473.c b/drivers/media/dvb-frontends/mn88473.c index fefc640d8afb..371f9faa3038 100644 --- a/drivers/media/dvb-frontends/mn88473.c +++ b/drivers/media/dvb-frontends/mn88473.c @@ -626,7 +626,7 @@ static int mn88473_probe(struct i2c_client *client) goto err; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/mt312.c b/drivers/media/dvb-frontends/mt312.c index fb867dd8a26b..06d7153f57d8 100644 --- a/drivers/media/dvb-frontends/mt312.c +++ b/drivers/media/dvb-frontends/mt312.c @@ -780,7 +780,7 @@ struct dvb_frontend *mt312_attach(const struct mt312_config *config, struct mt312_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct mt312_state), GFP_KERNEL); + state = kzalloc_obj(struct mt312_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/mt352.c b/drivers/media/dvb-frontends/mt352.c index 1b2889f5cf67..3f57ac209654 100644 --- a/drivers/media/dvb-frontends/mt352.c +++ b/drivers/media/dvb-frontends/mt352.c @@ -533,7 +533,7 @@ struct dvb_frontend* mt352_attach(const struct mt352_config* config, struct mt352_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct mt352_state), GFP_KERNEL); + state = kzalloc_obj(struct mt352_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/mxl5xx.c b/drivers/media/dvb-frontends/mxl5xx.c index 930da176e5bf..43d953c898fd 100644 --- a/drivers/media/dvb-frontends/mxl5xx.c +++ b/drivers/media/dvb-frontends/mxl5xx.c @@ -1829,7 +1829,7 @@ struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c, struct mxl *state; struct mxl_base *base; - state = kzalloc(sizeof(struct mxl), GFP_KERNEL); + state = kzalloc_obj(struct mxl, GFP_KERNEL); if (!state) return NULL; @@ -1845,7 +1845,7 @@ struct dvb_frontend *mxl5xx_attach(struct i2c_adapter *i2c, goto fail; state->base = base; } else { - base = kzalloc(sizeof(struct mxl_base), GFP_KERNEL); + base = kzalloc_obj(struct mxl_base, GFP_KERNEL); if (!base) goto fail; base->i2c = i2c; diff --git a/drivers/media/dvb-frontends/mxl692.c b/drivers/media/dvb-frontends/mxl692.c index bbc2bc778225..68455628b03d 100644 --- a/drivers/media/dvb-frontends/mxl692.c +++ b/drivers/media/dvb-frontends/mxl692.c @@ -1314,7 +1314,7 @@ static int mxl692_probe(struct i2c_client *client) struct mxl692_dev *dev; int ret = 0; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; dev_dbg(&client->dev, "kzalloc() failed\n"); diff --git a/drivers/media/dvb-frontends/nxt200x.c b/drivers/media/dvb-frontends/nxt200x.c index 1c549ada6ebf..5b0762938c86 100644 --- a/drivers/media/dvb-frontends/nxt200x.c +++ b/drivers/media/dvb-frontends/nxt200x.c @@ -1128,7 +1128,7 @@ struct dvb_frontend* nxt200x_attach(const struct nxt200x_config* config, u8 buf [] = {0,0,0,0,0}; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct nxt200x_state), GFP_KERNEL); + state = kzalloc_obj(struct nxt200x_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/nxt6000.c b/drivers/media/dvb-frontends/nxt6000.c index e8d4940370dd..ed12ef9cd9df 100644 --- a/drivers/media/dvb-frontends/nxt6000.c +++ b/drivers/media/dvb-frontends/nxt6000.c @@ -560,7 +560,7 @@ struct dvb_frontend* nxt6000_attach(const struct nxt6000_config* config, struct nxt6000_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct nxt6000_state), GFP_KERNEL); + state = kzalloc_obj(struct nxt6000_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/or51132.c b/drivers/media/dvb-frontends/or51132.c index 74e04c7cca1e..4b0063823736 100644 --- a/drivers/media/dvb-frontends/or51132.c +++ b/drivers/media/dvb-frontends/or51132.c @@ -552,7 +552,7 @@ struct dvb_frontend* or51132_attach(const struct or51132_config* config, struct or51132_state* state = NULL; /* Allocate memory for the internal state */ - state = kzalloc(sizeof(struct or51132_state), GFP_KERNEL); + state = kzalloc_obj(struct or51132_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/or51211.c b/drivers/media/dvb-frontends/or51211.c index 2e8e7071a67a..2a52b1dc9d0a 100644 --- a/drivers/media/dvb-frontends/or51211.c +++ b/drivers/media/dvb-frontends/or51211.c @@ -501,7 +501,7 @@ struct dvb_frontend* or51211_attach(const struct or51211_config* config, struct or51211_state* state = NULL; /* Allocate memory for the internal state */ - state = kzalloc(sizeof(struct or51211_state), GFP_KERNEL); + state = kzalloc_obj(struct or51211_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/rtl2830.c b/drivers/media/dvb-frontends/rtl2830.c index aa4ef9aedf17..ee6ba9b7c016 100644 --- a/drivers/media/dvb-frontends/rtl2830.c +++ b/drivers/media/dvb-frontends/rtl2830.c @@ -807,7 +807,7 @@ static int rtl2830_probe(struct i2c_client *client) } /* allocate memory for the internal state */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/rtl2832.c b/drivers/media/dvb-frontends/rtl2832.c index 3b4e46dac1bf..19ec892debb7 100644 --- a/drivers/media/dvb-frontends/rtl2832.c +++ b/drivers/media/dvb-frontends/rtl2832.c @@ -1043,7 +1043,7 @@ static int rtl2832_probe(struct i2c_client *client) dev_dbg(&client->dev, "\n"); /* allocate memory for the internal state */ - dev = kzalloc(sizeof(struct rtl2832_dev), GFP_KERNEL); + dev = kzalloc_obj(struct rtl2832_dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/rtl2832_sdr.c b/drivers/media/dvb-frontends/rtl2832_sdr.c index 0357624968f1..5a59bdde8f7b 100644 --- a/drivers/media/dvb-frontends/rtl2832_sdr.c +++ b/drivers/media/dvb-frontends/rtl2832_sdr.c @@ -1330,7 +1330,7 @@ static int rtl2832_sdr_probe(struct platform_device *pdev) ret = -EINVAL; goto err; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; goto err_module_put; diff --git a/drivers/media/dvb-frontends/s5h1409.c b/drivers/media/dvb-frontends/s5h1409.c index 28b1dca077ea..33f820e2d6d3 100644 --- a/drivers/media/dvb-frontends/s5h1409.c +++ b/drivers/media/dvb-frontends/s5h1409.c @@ -946,7 +946,7 @@ struct dvb_frontend *s5h1409_attach(const struct s5h1409_config *config, u16 reg; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct s5h1409_state), GFP_KERNEL); + state = kzalloc_obj(struct s5h1409_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/s5h1411.c b/drivers/media/dvb-frontends/s5h1411.c index fc48e659c2d8..c6379da7361e 100644 --- a/drivers/media/dvb-frontends/s5h1411.c +++ b/drivers/media/dvb-frontends/s5h1411.c @@ -861,7 +861,7 @@ struct dvb_frontend *s5h1411_attach(const struct s5h1411_config *config, u16 reg; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct s5h1411_state), GFP_KERNEL); + state = kzalloc_obj(struct s5h1411_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/s5h1420.c b/drivers/media/dvb-frontends/s5h1420.c index d700de1ea6c2..623900e732c1 100644 --- a/drivers/media/dvb-frontends/s5h1420.c +++ b/drivers/media/dvb-frontends/s5h1420.c @@ -872,7 +872,8 @@ struct dvb_frontend *s5h1420_attach(const struct s5h1420_config *config, struct i2c_adapter *i2c) { /* allocate memory for the internal state */ - struct s5h1420_state *state = kzalloc(sizeof(struct s5h1420_state), GFP_KERNEL); + struct s5h1420_state *state = kzalloc_obj(struct s5h1420_state, + GFP_KERNEL); u8 i; if (state == NULL) diff --git a/drivers/media/dvb-frontends/s5h1432.c b/drivers/media/dvb-frontends/s5h1432.c index ff5d3bdf3bc6..6261df9f383c 100644 --- a/drivers/media/dvb-frontends/s5h1432.c +++ b/drivers/media/dvb-frontends/s5h1432.c @@ -337,7 +337,7 @@ struct dvb_frontend *s5h1432_attach(const struct s5h1432_config *config, printk(KERN_INFO " Enter s5h1432_attach(). attach success!\n"); /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct s5h1432_state), GFP_KERNEL); + state = kmalloc_obj(struct s5h1432_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/s921.c b/drivers/media/dvb-frontends/s921.c index 7e461ac159fc..6d38c9742f1d 100644 --- a/drivers/media/dvb-frontends/s921.c +++ b/drivers/media/dvb-frontends/s921.c @@ -476,7 +476,7 @@ struct dvb_frontend *s921_attach(const struct s921_config *config, { /* allocate memory for the internal state */ struct s921_state *state = - kzalloc(sizeof(struct s921_state), GFP_KERNEL); + kzalloc_obj(struct s921_state, GFP_KERNEL); dprintk("\n"); if (!state) { diff --git a/drivers/media/dvb-frontends/si2165.c b/drivers/media/dvb-frontends/si2165.c index f87c9357cee3..cb6802b81e41 100644 --- a/drivers/media/dvb-frontends/si2165.c +++ b/drivers/media/dvb-frontends/si2165.c @@ -1158,7 +1158,7 @@ static int si2165_probe(struct i2c_client *client) }; /* allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) { ret = -ENOMEM; goto error; diff --git a/drivers/media/dvb-frontends/si2168.c b/drivers/media/dvb-frontends/si2168.c index d6b6b8bc7d4e..f7a1d2fc3cfb 100644 --- a/drivers/media/dvb-frontends/si2168.c +++ b/drivers/media/dvb-frontends/si2168.c @@ -681,7 +681,7 @@ static int si2168_probe(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/si21xx.c b/drivers/media/dvb-frontends/si21xx.c index 210ccd356e2b..ac50df3c40fb 100644 --- a/drivers/media/dvb-frontends/si21xx.c +++ b/drivers/media/dvb-frontends/si21xx.c @@ -902,7 +902,7 @@ struct dvb_frontend *si21xx_attach(const struct si21xx_config *config, dprintk("%s\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct si21xx_state), GFP_KERNEL); + state = kzalloc_obj(struct si21xx_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/sp2.c b/drivers/media/dvb-frontends/sp2.c index 75adf2a4589f..50103c4a36f9 100644 --- a/drivers/media/dvb-frontends/sp2.c +++ b/drivers/media/dvb-frontends/sp2.c @@ -371,7 +371,7 @@ static int sp2_probe(struct i2c_client *client) dev_dbg(&client->dev, "\n"); - s = kzalloc(sizeof(*s), GFP_KERNEL); + s = kzalloc_obj(*s, GFP_KERNEL); if (!s) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/sp887x.c b/drivers/media/dvb-frontends/sp887x.c index f59c0f96416b..235ecfd45376 100644 --- a/drivers/media/dvb-frontends/sp887x.c +++ b/drivers/media/dvb-frontends/sp887x.c @@ -568,7 +568,7 @@ struct dvb_frontend* sp887x_attach(const struct sp887x_config* config, struct sp887x_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct sp887x_state), GFP_KERNEL); + state = kzalloc_obj(struct sp887x_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/stb0899_drv.c b/drivers/media/dvb-frontends/stb0899_drv.c index 35634f9a8ab5..19a31a296e0f 100644 --- a/drivers/media/dvb-frontends/stb0899_drv.c +++ b/drivers/media/dvb-frontends/stb0899_drv.c @@ -1613,7 +1613,7 @@ struct dvb_frontend *stb0899_attach(struct stb0899_config *config, struct i2c_ad { struct stb0899_state *state = NULL; - state = kzalloc(sizeof (struct stb0899_state), GFP_KERNEL); + state = kzalloc_obj(struct stb0899_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/stb6000.c b/drivers/media/dvb-frontends/stb6000.c index d74e34677b92..85900e616490 100644 --- a/drivers/media/dvb-frontends/stb6000.c +++ b/drivers/media/dvb-frontends/stb6000.c @@ -218,7 +218,7 @@ struct dvb_frontend *stb6000_attach(struct dvb_frontend *fe, int addr, if (ret != 2) return NULL; - priv = kzalloc(sizeof(struct stb6000_priv), GFP_KERNEL); + priv = kzalloc_obj(struct stb6000_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/stb6100.c b/drivers/media/dvb-frontends/stb6100.c index c5818a15a0d7..97238cf98067 100644 --- a/drivers/media/dvb-frontends/stb6100.c +++ b/drivers/media/dvb-frontends/stb6100.c @@ -534,7 +534,7 @@ struct dvb_frontend *stb6100_attach(struct dvb_frontend *fe, { struct stb6100_state *state = NULL; - state = kzalloc(sizeof (struct stb6100_state), GFP_KERNEL); + state = kzalloc_obj(struct stb6100_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/stv0288.c b/drivers/media/dvb-frontends/stv0288.c index a5581bd60f9e..40648b74edd4 100644 --- a/drivers/media/dvb-frontends/stv0288.c +++ b/drivers/media/dvb-frontends/stv0288.c @@ -557,7 +557,7 @@ struct dvb_frontend *stv0288_attach(const struct stv0288_config *config, int id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0288_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0288_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/stv0297.c b/drivers/media/dvb-frontends/stv0297.c index 9d4dbd99a5a7..c0634e2436b3 100644 --- a/drivers/media/dvb-frontends/stv0297.c +++ b/drivers/media/dvb-frontends/stv0297.c @@ -654,7 +654,7 @@ struct dvb_frontend *stv0297_attach(const struct stv0297_config *config, struct stv0297_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0297_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0297_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/stv0299.c b/drivers/media/dvb-frontends/stv0299.c index ba4bb3685095..cc15bb93b7dc 100644 --- a/drivers/media/dvb-frontends/stv0299.c +++ b/drivers/media/dvb-frontends/stv0299.c @@ -671,7 +671,7 @@ struct dvb_frontend* stv0299_attach(const struct stv0299_config* config, int id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0299_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0299_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/stv0367.c b/drivers/media/dvb-frontends/stv0367.c index 72540ef4e5f8..cf6b1b646b10 100644 --- a/drivers/media/dvb-frontends/stv0367.c +++ b/drivers/media/dvb-frontends/stv0367.c @@ -1698,10 +1698,10 @@ struct dvb_frontend *stv0367ter_attach(const struct stv0367_config *config, struct stv0367ter_state *ter_state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0367_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0367_state, GFP_KERNEL); if (state == NULL) goto error; - ter_state = kzalloc(sizeof(struct stv0367ter_state), GFP_KERNEL); + ter_state = kzalloc_obj(struct stv0367ter_state, GFP_KERNEL); if (ter_state == NULL) goto error; @@ -2865,10 +2865,10 @@ struct dvb_frontend *stv0367cab_attach(const struct stv0367_config *config, struct stv0367cab_state *cab_state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0367_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0367_state, GFP_KERNEL); if (state == NULL) goto error; - cab_state = kzalloc(sizeof(struct stv0367cab_state), GFP_KERNEL); + cab_state = kzalloc_obj(struct stv0367cab_state, GFP_KERNEL); if (cab_state == NULL) goto error; @@ -3274,13 +3274,13 @@ struct dvb_frontend *stv0367ddb_attach(const struct stv0367_config *config, struct stv0367cab_state *cab_state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct stv0367_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0367_state, GFP_KERNEL); if (state == NULL) goto error; - ter_state = kzalloc(sizeof(struct stv0367ter_state), GFP_KERNEL); + ter_state = kzalloc_obj(struct stv0367ter_state, GFP_KERNEL); if (ter_state == NULL) goto error; - cab_state = kzalloc(sizeof(struct stv0367cab_state), GFP_KERNEL); + cab_state = kzalloc_obj(struct stv0367cab_state, GFP_KERNEL); if (cab_state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/stv0900_core.c b/drivers/media/dvb-frontends/stv0900_core.c index e7b9b9b11d7d..3f1edc8559c5 100644 --- a/drivers/media/dvb-frontends/stv0900_core.c +++ b/drivers/media/dvb-frontends/stv0900_core.c @@ -85,14 +85,14 @@ static struct stv0900_inode *append_internal(struct stv0900_internal *internal) struct stv0900_inode *new_node = stv0900_first_inode; if (new_node == NULL) { - new_node = kmalloc(sizeof(struct stv0900_inode), GFP_KERNEL); + new_node = kmalloc_obj(struct stv0900_inode, GFP_KERNEL); stv0900_first_inode = new_node; } else { while (new_node->next_inode != NULL) new_node = new_node->next_inode; - new_node->next_inode = kmalloc(sizeof(struct stv0900_inode), - GFP_KERNEL); + new_node->next_inode = kmalloc_obj(struct stv0900_inode, + GFP_KERNEL); if (new_node->next_inode != NULL) new_node = new_node->next_inode; else @@ -1348,8 +1348,8 @@ static enum fe_stv0900_error stv0900_init_internal(struct dvb_frontend *fe, dprintk("%s: Find Internal Structure!\n", __func__); return STV0900_NO_ERROR; } else { - state->internal = kmalloc(sizeof(struct stv0900_internal), - GFP_KERNEL); + state->internal = kmalloc_obj(struct stv0900_internal, + GFP_KERNEL); if (state->internal == NULL) return STV0900_INVALID_HANDLE; temp_int = append_internal(state->internal); @@ -1903,7 +1903,7 @@ struct dvb_frontend *stv0900_attach(const struct stv0900_config *config, struct stv0900_init_params init_params; enum fe_stv0900_error err_stv0900; - state = kzalloc(sizeof(struct stv0900_state), GFP_KERNEL); + state = kzalloc_obj(struct stv0900_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/stv090x.c b/drivers/media/dvb-frontends/stv090x.c index f273efa330cf..16ff5c8cf417 100644 --- a/drivers/media/dvb-frontends/stv090x.c +++ b/drivers/media/dvb-frontends/stv090x.c @@ -85,7 +85,7 @@ static struct stv090x_dev *append_internal(struct stv090x_internal *internal) struct stv090x_dev *new_dev; struct stv090x_dev *temp_dev; - new_dev = kmalloc(sizeof(struct stv090x_dev), GFP_KERNEL); + new_dev = kmalloc_obj(struct stv090x_dev, GFP_KERNEL); if (new_dev != NULL) { new_dev->internal = internal; new_dev->next_dev = NULL; @@ -4906,7 +4906,7 @@ static int stv090x_setup_compound(struct stv090x_state *state) state->internal->num_used++; dprintk(FE_INFO, 1, "Found Internal Structure!"); } else { - state->internal = kmalloc(sizeof(*state->internal), GFP_KERNEL); + state->internal = kmalloc_obj(*state->internal, GFP_KERNEL); if (!state->internal) goto error; temp_int = append_internal(state->internal); @@ -5002,7 +5002,7 @@ static int stv090x_probe(struct i2c_client *client) struct stv090x_state *state = NULL; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) { ret = -ENOMEM; goto error; @@ -5050,7 +5050,7 @@ struct dvb_frontend *stv090x_attach(struct stv090x_config *config, int ret = 0; struct stv090x_state *state = NULL; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) goto error; diff --git a/drivers/media/dvb-frontends/stv0910.c b/drivers/media/dvb-frontends/stv0910.c index 069dec75129c..666562f7ca17 100644 --- a/drivers/media/dvb-frontends/stv0910.c +++ b/drivers/media/dvb-frontends/stv0910.c @@ -1766,7 +1766,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, struct stv *state; struct stv_base *base; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; @@ -1788,7 +1788,7 @@ struct dvb_frontend *stv0910_attach(struct i2c_adapter *i2c, base->count++; state->base = base; } else { - base = kzalloc(sizeof(*base), GFP_KERNEL); + base = kzalloc_obj(*base, GFP_KERNEL); if (!base) goto fail; base->i2c = i2c; diff --git a/drivers/media/dvb-frontends/stv6110.c b/drivers/media/dvb-frontends/stv6110.c index 1cf9c095dbff..beb1c832a13d 100644 --- a/drivers/media/dvb-frontends/stv6110.c +++ b/drivers/media/dvb-frontends/stv6110.c @@ -408,7 +408,7 @@ struct dvb_frontend *stv6110_attach(struct dvb_frontend *fe, if (ret != 1) return NULL; - priv = kzalloc(sizeof(struct stv6110_priv), GFP_KERNEL); + priv = kzalloc_obj(struct stv6110_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/stv6110x.c b/drivers/media/dvb-frontends/stv6110x.c index 33c8105da1c3..4122f7655b0a 100644 --- a/drivers/media/dvb-frontends/stv6110x.c +++ b/drivers/media/dvb-frontends/stv6110x.c @@ -412,7 +412,7 @@ static int stv6110x_probe(struct i2c_client *client) struct stv6110x_state *stv6110x; - stv6110x = kzalloc(sizeof(*stv6110x), GFP_KERNEL); + stv6110x = kzalloc_obj(*stv6110x, GFP_KERNEL); if (!stv6110x) return -ENOMEM; @@ -448,7 +448,7 @@ const struct stv6110x_devctl *stv6110x_attach(struct dvb_frontend *fe, { struct stv6110x_state *stv6110x; - stv6110x = kzalloc(sizeof(*stv6110x), GFP_KERNEL); + stv6110x = kzalloc_obj(*stv6110x, GFP_KERNEL); if (!stv6110x) return NULL; diff --git a/drivers/media/dvb-frontends/stv6111.c b/drivers/media/dvb-frontends/stv6111.c index 0ac15273922d..d367ee7f3cbe 100644 --- a/drivers/media/dvb-frontends/stv6111.c +++ b/drivers/media/dvb-frontends/stv6111.c @@ -653,7 +653,7 @@ struct dvb_frontend *stv6111_attach(struct dvb_frontend *fe, int stat = -ENODEV; int gatestat = 0; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return NULL; state->adr = adr; diff --git a/drivers/media/dvb-frontends/tc90522.c b/drivers/media/dvb-frontends/tc90522.c index 1f8cbf45554a..3ac0b7a0844f 100644 --- a/drivers/media/dvb-frontends/tc90522.c +++ b/drivers/media/dvb-frontends/tc90522.c @@ -647,7 +647,7 @@ tc90522_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) for (i = 0; i < num; i++) if (msgs[i].flags & I2C_M_RD) rd_num++; - new_msgs = kmalloc_array(num + rd_num, sizeof(*new_msgs), GFP_KERNEL); + new_msgs = kmalloc_objs(*new_msgs, num + rd_num, GFP_KERNEL); if (!new_msgs) return -ENOMEM; @@ -788,7 +788,7 @@ static int tc90522_probe(struct i2c_client *client) struct i2c_adapter *adap; int ret; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return -ENOMEM; state->i2c_client = client; diff --git a/drivers/media/dvb-frontends/tda10021.c b/drivers/media/dvb-frontends/tda10021.c index 462e12ab6bd1..9a950ee9562e 100644 --- a/drivers/media/dvb-frontends/tda10021.c +++ b/drivers/media/dvb-frontends/tda10021.c @@ -451,7 +451,7 @@ struct dvb_frontend* tda10021_attach(const struct tda1002x_config* config, u8 id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda10021_state), GFP_KERNEL); + state = kzalloc_obj(struct tda10021_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/tda10023.c b/drivers/media/dvb-frontends/tda10023.c index 4c2541ecd743..c8b1cc0f7abb 100644 --- a/drivers/media/dvb-frontends/tda10023.c +++ b/drivers/media/dvb-frontends/tda10023.c @@ -511,7 +511,7 @@ struct dvb_frontend *tda10023_attach(const struct tda10023_config *config, struct tda10023_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda10023_state), GFP_KERNEL); + state = kzalloc_obj(struct tda10023_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/tda10048.c b/drivers/media/dvb-frontends/tda10048.c index 1f87eb0dcf2a..fe9685cbf7a5 100644 --- a/drivers/media/dvb-frontends/tda10048.c +++ b/drivers/media/dvb-frontends/tda10048.c @@ -1097,7 +1097,7 @@ struct dvb_frontend *tda10048_attach(const struct tda10048_config *config, dprintk(1, "%s()\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda10048_state), GFP_KERNEL); + state = kzalloc_obj(struct tda10048_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/tda1004x.c b/drivers/media/dvb-frontends/tda1004x.c index 6f306db6c615..0a1bf80211d3 100644 --- a/drivers/media/dvb-frontends/tda1004x.c +++ b/drivers/media/dvb-frontends/tda1004x.c @@ -1271,7 +1271,7 @@ struct dvb_frontend* tda10045_attach(const struct tda1004x_config* config, int id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); + state = kzalloc_obj(struct tda1004x_state, GFP_KERNEL); if (!state) { printk(KERN_ERR "Can't allocate memory for tda10045 state\n"); return NULL; @@ -1341,7 +1341,7 @@ struct dvb_frontend* tda10046_attach(const struct tda1004x_config* config, int id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda1004x_state), GFP_KERNEL); + state = kzalloc_obj(struct tda1004x_state, GFP_KERNEL); if (!state) { printk(KERN_ERR "Can't allocate memory for tda10046 state\n"); return NULL; diff --git a/drivers/media/dvb-frontends/tda10071.c b/drivers/media/dvb-frontends/tda10071.c index e23794b821cd..430702da6e79 100644 --- a/drivers/media/dvb-frontends/tda10071.c +++ b/drivers/media/dvb-frontends/tda10071.c @@ -1156,7 +1156,7 @@ static int tda10071_probe(struct i2c_client *client) .val_bits = 8, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/tda10086.c b/drivers/media/dvb-frontends/tda10086.c index b449514ae585..5e63ded2cfbf 100644 --- a/drivers/media/dvb-frontends/tda10086.c +++ b/drivers/media/dvb-frontends/tda10086.c @@ -737,7 +737,7 @@ struct dvb_frontend* tda10086_attach(const struct tda10086_config* config, dprintk ("%s\n", __func__); /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda10086_state), GFP_KERNEL); + state = kzalloc_obj(struct tda10086_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/tda18271c2dd.c b/drivers/media/dvb-frontends/tda18271c2dd.c index c11563853c07..f10d74ff192c 100644 --- a/drivers/media/dvb-frontends/tda18271c2dd.c +++ b/drivers/media/dvb-frontends/tda18271c2dd.c @@ -1215,7 +1215,7 @@ struct dvb_frontend *tda18271c2dd_attach(struct dvb_frontend *fe, { struct tda_state *state; - state = kzalloc(sizeof(struct tda_state), GFP_KERNEL); + state = kzalloc_obj(struct tda_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/tda665x.c b/drivers/media/dvb-frontends/tda665x.c index 346be5011fb7..f9dcbb69e949 100644 --- a/drivers/media/dvb-frontends/tda665x.c +++ b/drivers/media/dvb-frontends/tda665x.c @@ -207,7 +207,7 @@ struct dvb_frontend *tda665x_attach(struct dvb_frontend *fe, struct tda665x_state *state = NULL; struct dvb_tuner_info *info; - state = kzalloc(sizeof(struct tda665x_state), GFP_KERNEL); + state = kzalloc_obj(struct tda665x_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/tda8083.c b/drivers/media/dvb-frontends/tda8083.c index 44f53624557b..c9f280cdd7db 100644 --- a/drivers/media/dvb-frontends/tda8083.c +++ b/drivers/media/dvb-frontends/tda8083.c @@ -417,7 +417,7 @@ struct dvb_frontend* tda8083_attach(const struct tda8083_config* config, struct tda8083_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct tda8083_state), GFP_KERNEL); + state = kzalloc_obj(struct tda8083_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/tda8261.c b/drivers/media/dvb-frontends/tda8261.c index 8b06f92745dc..73c90442f403 100644 --- a/drivers/media/dvb-frontends/tda8261.c +++ b/drivers/media/dvb-frontends/tda8261.c @@ -168,7 +168,7 @@ struct dvb_frontend *tda8261_attach(struct dvb_frontend *fe, { struct tda8261_state *state = NULL; - if ((state = kzalloc(sizeof (struct tda8261_state), GFP_KERNEL)) == NULL) + if ((state = kzalloc_obj(struct tda8261_state, GFP_KERNEL)) == NULL) goto exit; state->config = config; diff --git a/drivers/media/dvb-frontends/tda826x.c b/drivers/media/dvb-frontends/tda826x.c index eafcf5f7da3d..b51da4053ef5 100644 --- a/drivers/media/dvb-frontends/tda826x.c +++ b/drivers/media/dvb-frontends/tda826x.c @@ -150,7 +150,7 @@ struct dvb_frontend *tda826x_attach(struct dvb_frontend *fe, int addr, struct i2 if (!(b1[1] & 0x80)) return NULL; - priv = kzalloc(sizeof(struct tda826x_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tda826x_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/ts2020.c b/drivers/media/dvb-frontends/ts2020.c index e25add6cc38e..2368214781a6 100644 --- a/drivers/media/dvb-frontends/ts2020.c +++ b/drivers/media/dvb-frontends/ts2020.c @@ -566,7 +566,7 @@ static int ts2020_probe(struct i2c_client *client) } fe = pdata->fe; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/tua6100.c b/drivers/media/dvb-frontends/tua6100.c index 41dd9b6d3190..2d052bfb8a23 100644 --- a/drivers/media/dvb-frontends/tua6100.c +++ b/drivers/media/dvb-frontends/tua6100.c @@ -175,7 +175,7 @@ struct dvb_frontend *tua6100_attach(struct dvb_frontend *fe, int addr, struct i2 if (ret != 2) return NULL; - priv = kzalloc(sizeof(struct tua6100_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tua6100_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/dvb-frontends/ves1820.c b/drivers/media/dvb-frontends/ves1820.c index ee5620e731e9..56bbd52d1783 100644 --- a/drivers/media/dvb-frontends/ves1820.c +++ b/drivers/media/dvb-frontends/ves1820.c @@ -366,7 +366,7 @@ struct dvb_frontend* ves1820_attach(const struct ves1820_config* config, struct ves1820_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct ves1820_state), GFP_KERNEL); + state = kzalloc_obj(struct ves1820_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/ves1x93.c b/drivers/media/dvb-frontends/ves1x93.c index c60e21d26b88..5c8abcebbd88 100644 --- a/drivers/media/dvb-frontends/ves1x93.c +++ b/drivers/media/dvb-frontends/ves1x93.c @@ -450,7 +450,7 @@ struct dvb_frontend* ves1x93_attach(const struct ves1x93_config* config, u8 identity; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct ves1x93_state), GFP_KERNEL); + state = kzalloc_obj(struct ves1x93_state, GFP_KERNEL); if (state == NULL) goto error; /* setup the state */ diff --git a/drivers/media/dvb-frontends/zd1301_demod.c b/drivers/media/dvb-frontends/zd1301_demod.c index e8b9e67a8717..0c244fd17623 100644 --- a/drivers/media/dvb-frontends/zd1301_demod.c +++ b/drivers/media/dvb-frontends/zd1301_demod.c @@ -470,7 +470,7 @@ static int zd1301_demod_probe(struct platform_device *pdev) goto err; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/dvb-frontends/zl10036.c b/drivers/media/dvb-frontends/zl10036.c index 5ad987c6861b..3d05828e499a 100644 --- a/drivers/media/dvb-frontends/zl10036.c +++ b/drivers/media/dvb-frontends/zl10036.c @@ -457,7 +457,7 @@ struct dvb_frontend *zl10036_attach(struct dvb_frontend *fe, return NULL; } - state = kzalloc(sizeof(struct zl10036_state), GFP_KERNEL); + state = kzalloc_obj(struct zl10036_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/dvb-frontends/zl10039.c b/drivers/media/dvb-frontends/zl10039.c index a3e4d219400c..54e1e4267c1d 100644 --- a/drivers/media/dvb-frontends/zl10039.c +++ b/drivers/media/dvb-frontends/zl10039.c @@ -254,7 +254,7 @@ struct dvb_frontend *zl10039_attach(struct dvb_frontend *fe, struct zl10039_state *state = NULL; dprintk("%s\n", __func__); - state = kmalloc(sizeof(struct zl10039_state), GFP_KERNEL); + state = kmalloc_obj(struct zl10039_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/dvb-frontends/zl10353.c b/drivers/media/dvb-frontends/zl10353.c index 8849d05475c2..a9f23b142301 100644 --- a/drivers/media/dvb-frontends/zl10353.c +++ b/drivers/media/dvb-frontends/zl10353.c @@ -598,7 +598,7 @@ struct dvb_frontend *zl10353_attach(const struct zl10353_config *config, int id; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct zl10353_state), GFP_KERNEL); + state = kzalloc_obj(struct zl10353_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/firewire/firedtv-fw.c b/drivers/media/firewire/firedtv-fw.c index 5f6e97a8d1c0..5ee96f290fef 100644 --- a/drivers/media/firewire/firedtv-fw.c +++ b/drivers/media/firewire/firedtv-fw.c @@ -135,7 +135,7 @@ int fdtv_start_iso(struct firedtv *fdtv) struct fw_device *device = device_of(fdtv); int i, err; - ctx = kmalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kmalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; @@ -255,7 +255,7 @@ static int node_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) char name[MAX_MODEL_NAME_LEN]; int name_len, i, err; - fdtv = kzalloc(sizeof(*fdtv), GFP_KERNEL); + fdtv = kzalloc_obj(*fdtv, GFP_KERNEL); if (!fdtv) return -ENOMEM; diff --git a/drivers/media/i2c/alvium-csi2.c b/drivers/media/i2c/alvium-csi2.c index 1f088acecf36..c063da7d568d 100644 --- a/drivers/media/i2c/alvium-csi2.c +++ b/drivers/media/i2c/alvium-csi2.c @@ -1094,7 +1094,7 @@ static int alvium_setup_mipi_fmt(struct alvium_dev *alvium) /* init alvium_csi2_fmt array */ alvium->alvium_csi2_fmt_n = sz; alvium->alvium_csi2_fmt = - kmalloc_array(sz, sizeof(struct alvium_pixfmt), GFP_KERNEL); + kmalloc_objs(struct alvium_pixfmt, sz, GFP_KERNEL); if (!alvium->alvium_csi2_fmt) return -ENOMEM; diff --git a/drivers/media/i2c/cs3308.c b/drivers/media/i2c/cs3308.c index 078e0066ce4b..cc4bd7fd7cdb 100644 --- a/drivers/media/i2c/cs3308.c +++ b/drivers/media/i2c/cs3308.c @@ -79,7 +79,7 @@ static int cs3308_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%x (%s)\n", client->addr << 1, client->adapter->name); - sd = kzalloc(sizeof(struct v4l2_subdev), GFP_KERNEL); + sd = kzalloc_obj(struct v4l2_subdev, GFP_KERNEL); if (sd == NULL) return -ENOMEM; diff --git a/drivers/media/i2c/ds90ub960.c b/drivers/media/i2c/ds90ub960.c index 3156f6d6c6de..98f45dcad667 100644 --- a/drivers/media/i2c/ds90ub960.c +++ b/drivers/media/i2c/ds90ub960.c @@ -1379,7 +1379,7 @@ static int ub960_parse_dt_txport(struct ub960_data *priv, struct ub960_txport *txport; int ret; - txport = kzalloc(sizeof(*txport), GFP_KERNEL); + txport = kzalloc_obj(*txport, GFP_KERNEL); if (!txport) return -ENOMEM; @@ -4573,7 +4573,7 @@ static int ub960_parse_dt_rxport(struct ub960_data *priv, unsigned int nport, struct ub960_rxport *rxport; int ret; - rxport = kzalloc(sizeof(*rxport), GFP_KERNEL); + rxport = kzalloc_obj(*rxport, GFP_KERNEL); if (!rxport) return -ENOMEM; diff --git a/drivers/media/i2c/tda1997x.c b/drivers/media/i2c/tda1997x.c index 3532766cd795..bf4f7b44d42e 100644 --- a/drivers/media/i2c/tda1997x.c +++ b/drivers/media/i2c/tda1997x.c @@ -2538,7 +2538,7 @@ static int tda1997x_probe(struct i2c_client *client) if (!i2c_check_functionality(client->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) return -EIO; - state = kzalloc(sizeof(struct tda1997x_state), GFP_KERNEL); + state = kzalloc_obj(struct tda1997x_state, GFP_KERNEL); if (!state) return -ENOMEM; diff --git a/drivers/media/i2c/video-i2c.c b/drivers/media/i2c/video-i2c.c index 1eee2d4f5b40..eebca7a0fb9b 100644 --- a/drivers/media/i2c/video-i2c.c +++ b/drivers/media/i2c/video-i2c.c @@ -750,7 +750,7 @@ static int video_i2c_probe(struct i2c_client *client) struct vb2_queue *queue; int ret = -ENODEV; - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) return -ENOMEM; diff --git a/drivers/media/mc/mc-dev-allocator.c b/drivers/media/mc/mc-dev-allocator.c index ae17887dec59..b8a170aaee04 100644 --- a/drivers/media/mc/mc-dev-allocator.c +++ b/drivers/media/mc/mc-dev-allocator.c @@ -81,7 +81,7 @@ static struct media_device *__media_device_get(struct device *dev, return &mdi->mdev; } - mdi = kzalloc(sizeof(*mdi), GFP_KERNEL); + mdi = kzalloc_obj(*mdi, GFP_KERNEL); if (!mdi) return NULL; diff --git a/drivers/media/mc/mc-device.c b/drivers/media/mc/mc-device.c index 5a4465b290f0..a27afa530592 100644 --- a/drivers/media/mc/mc-device.c +++ b/drivers/media/mc/mc-device.c @@ -737,7 +737,7 @@ int __must_check __media_device_register(struct media_device *mdev, struct media_devnode *devnode; int ret; - devnode = kzalloc(sizeof(*devnode), GFP_KERNEL); + devnode = kzalloc_obj(*devnode, GFP_KERNEL); if (!devnode) return -ENOMEM; diff --git a/drivers/media/mc/mc-entity.c b/drivers/media/mc/mc-entity.c index 9519a537bfa2..a078488874b2 100644 --- a/drivers/media/mc/mc-entity.c +++ b/drivers/media/mc/mc-entity.c @@ -587,7 +587,7 @@ static int media_pipeline_add_pad(struct media_pipeline *pipe, } } - ppad = kzalloc(sizeof(*ppad), GFP_KERNEL); + ppad = kzalloc_obj(*ppad, GFP_KERNEL); if (!ppad) return -ENOMEM; @@ -977,7 +977,7 @@ __must_check int media_pipeline_alloc_start(struct media_pad *pad) */ pipe = media_pad_pipeline(pad); if (!pipe) { - new_pipe = kzalloc(sizeof(*new_pipe), GFP_KERNEL); + new_pipe = kzalloc_obj(*new_pipe, GFP_KERNEL); if (!new_pipe) { ret = -ENOMEM; goto out; @@ -1061,7 +1061,7 @@ static struct media_link *media_add_link(struct list_head *head) { struct media_link *link; - link = kzalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc_obj(*link, GFP_KERNEL); if (link == NULL) return NULL; @@ -1547,7 +1547,7 @@ struct media_intf_devnode *media_devnode_create(struct media_device *mdev, { struct media_intf_devnode *devnode; - devnode = kzalloc(sizeof(*devnode), GFP_KERNEL); + devnode = kzalloc_obj(*devnode, GFP_KERNEL); if (!devnode) return NULL; diff --git a/drivers/media/mc/mc-request.c b/drivers/media/mc/mc-request.c index 8ad10c72f9db..6668f44359ce 100644 --- a/drivers/media/mc/mc-request.c +++ b/drivers/media/mc/mc-request.c @@ -293,7 +293,7 @@ int media_request_alloc(struct media_device *mdev, int *alloc_fd) if (mdev->ops->req_alloc) req = mdev->ops->req_alloc(mdev); else - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (!req) return -ENOMEM; diff --git a/drivers/media/mmc/siano/smssdio.c b/drivers/media/mmc/siano/smssdio.c index 8199077faf36..8dc11576f4e8 100644 --- a/drivers/media/mmc/siano/smssdio.c +++ b/drivers/media/mmc/siano/smssdio.c @@ -244,7 +244,7 @@ static int smssdio_probe(struct sdio_func *func, board_id = id->driver_data; - smsdev = kzalloc(sizeof(struct smssdio_device), GFP_KERNEL); + smsdev = kzalloc_obj(struct smssdio_device, GFP_KERNEL); if (!smsdev) return -ENOMEM; diff --git a/drivers/media/pci/bt8xx/bttv-driver.c b/drivers/media/pci/bt8xx/bttv-driver.c index 17e4529e537a..26cc0f6b7571 100644 --- a/drivers/media/pci/bt8xx/bttv-driver.c +++ b/drivers/media/pci/bt8xx/bttv-driver.c @@ -3216,7 +3216,7 @@ static int bttv_probe(struct pci_dev *dev, const struct pci_device_id *pci_id) if (bttv_num == BTTV_MAX) return -ENOMEM; pr_info("Bt8xx card found (%d)\n", bttv_num); - bttvs[bttv_num] = btv = kzalloc(sizeof(*btv), GFP_KERNEL); + bttvs[bttv_num] = btv = kzalloc_obj(*btv, GFP_KERNEL); if (btv == NULL) { pr_err("out of memory\n"); return -ENOMEM; diff --git a/drivers/media/pci/bt8xx/bttv-gpio.c b/drivers/media/pci/bt8xx/bttv-gpio.c index 59a6f160aac7..5b4c6336d2d5 100644 --- a/drivers/media/pci/bt8xx/bttv-gpio.c +++ b/drivers/media/pci/bt8xx/bttv-gpio.c @@ -73,7 +73,7 @@ int bttv_sub_add_device(struct bttv_core *core, char *name) struct bttv_sub_device *sub; int err; - sub = kzalloc(sizeof(*sub),GFP_KERNEL); + sub = kzalloc_obj(*sub, GFP_KERNEL); if (NULL == sub) return -ENOMEM; diff --git a/drivers/media/pci/bt8xx/bttv-input.c b/drivers/media/pci/bt8xx/bttv-input.c index 84aa269248fd..45e30ebdc5f8 100644 --- a/drivers/media/pci/bt8xx/bttv-input.c +++ b/drivers/media/pci/bt8xx/bttv-input.c @@ -416,7 +416,7 @@ int bttv_input_init(struct bttv *btv) if (!btv->has_remote) return -ENODEV; - ir = kzalloc(sizeof(*ir),GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ir || !rc) goto err_out_free; diff --git a/drivers/media/pci/bt8xx/dst_ca.c b/drivers/media/pci/bt8xx/dst_ca.c index a9cc6e7a57f9..f26ece10d926 100644 --- a/drivers/media/pci/bt8xx/dst_ca.c +++ b/drivers/media/pci/bt8xx/dst_ca.c @@ -454,7 +454,7 @@ static int ca_send_message(struct dst_state *state, struct ca_msg *p_ca_message, struct ca_msg *hw_buffer; int result = 0; - hw_buffer = kmalloc(sizeof(*hw_buffer), GFP_KERNEL); + hw_buffer = kmalloc_obj(*hw_buffer, GFP_KERNEL); if (!hw_buffer) return -ENOMEM; dprintk(verbose, DST_CA_DEBUG, 1, " "); @@ -535,9 +535,9 @@ static long dst_ca_ioctl(struct file *file, unsigned int cmd, unsigned long ioct mutex_lock(&dst_ca_mutex); dvbdev = file->private_data; state = dvbdev->priv; - p_ca_message = kmalloc(sizeof (struct ca_msg), GFP_KERNEL); - p_ca_slot_info = kmalloc(sizeof (struct ca_slot_info), GFP_KERNEL); - p_ca_caps = kmalloc(sizeof (struct ca_caps), GFP_KERNEL); + p_ca_message = kmalloc_obj(struct ca_msg, GFP_KERNEL); + p_ca_slot_info = kmalloc_obj(struct ca_slot_info, GFP_KERNEL); + p_ca_caps = kmalloc_obj(struct ca_caps, GFP_KERNEL); if (!p_ca_message || !p_ca_slot_info || !p_ca_caps) { result = -ENOMEM; goto free_mem_and_exit; diff --git a/drivers/media/pci/bt8xx/dvb-bt8xx.c b/drivers/media/pci/bt8xx/dvb-bt8xx.c index f0fbb468aea2..b9c712c078d2 100644 --- a/drivers/media/pci/bt8xx/dvb-bt8xx.c +++ b/drivers/media/pci/bt8xx/dvb-bt8xx.c @@ -657,7 +657,7 @@ static void frontend_init(struct dvb_bt8xx_card *card, u32 type) case BTTV_BOARD_TWINHAN_DST: /* DST is not a frontend driver !!! */ - state = kmalloc(sizeof (struct dst_state), GFP_KERNEL); + state = kmalloc_obj(struct dst_state, GFP_KERNEL); if (!state) { pr_err("No memory\n"); break; @@ -809,7 +809,7 @@ static int dvb_bt8xx_probe(struct bttv_sub_device *sub) struct pci_dev* bttv_pci_dev; int ret; - if (!(card = kzalloc(sizeof(struct dvb_bt8xx_card), GFP_KERNEL))) + if (!(card = kzalloc_obj(struct dvb_bt8xx_card, GFP_KERNEL))) return -ENOMEM; mutex_init(&card->lock); diff --git a/drivers/media/pci/cobalt/cobalt-alsa-main.c b/drivers/media/pci/cobalt/cobalt-alsa-main.c index c57f87a68269..1b30b44ad112 100644 --- a/drivers/media/pci/cobalt/cobalt-alsa-main.c +++ b/drivers/media/pci/cobalt/cobalt-alsa-main.c @@ -45,7 +45,7 @@ static int snd_cobalt_card_create(struct cobalt_stream *s, struct snd_card *sc, struct snd_cobalt_card **cobsc) { - *cobsc = kzalloc(sizeof(struct snd_cobalt_card), GFP_KERNEL); + *cobsc = kzalloc_obj(struct snd_cobalt_card, GFP_KERNEL); if (*cobsc == NULL) return -ENOMEM; diff --git a/drivers/media/pci/cobalt/cobalt-driver.c b/drivers/media/pci/cobalt/cobalt-driver.c index b7695705fdee..1c2b00278c55 100644 --- a/drivers/media/pci/cobalt/cobalt-driver.c +++ b/drivers/media/pci/cobalt/cobalt-driver.c @@ -663,7 +663,7 @@ static int cobalt_probe(struct pci_dev *pci_dev, /* FIXME - module parameter arrays constrain max instances */ i = atomic_inc_return(&cobalt_instance) - 1; - cobalt = kzalloc(sizeof(struct cobalt), GFP_KERNEL); + cobalt = kzalloc_obj(struct cobalt, GFP_KERNEL); if (cobalt == NULL) return -ENOMEM; cobalt->pci_dev = pci_dev; diff --git a/drivers/media/pci/cx18/cx18-alsa-main.c b/drivers/media/pci/cx18/cx18-alsa-main.c index 9dc361886284..6214e29a5cd6 100644 --- a/drivers/media/pci/cx18/cx18-alsa-main.c +++ b/drivers/media/pci/cx18/cx18-alsa-main.c @@ -77,7 +77,7 @@ static int snd_cx18_card_create(struct v4l2_device *v4l2_dev, struct snd_card *sc, struct snd_cx18_card **cxsc) { - *cxsc = kzalloc(sizeof(struct snd_cx18_card), GFP_KERNEL); + *cxsc = kzalloc_obj(struct snd_cx18_card, GFP_KERNEL); if (*cxsc == NULL) return -ENOMEM; diff --git a/drivers/media/pci/cx18/cx18-driver.c b/drivers/media/pci/cx18/cx18-driver.c index 74c59a94b2b0..bdfdd403a039 100644 --- a/drivers/media/pci/cx18/cx18-driver.c +++ b/drivers/media/pci/cx18/cx18-driver.c @@ -314,7 +314,7 @@ void cx18_read_eeprom(struct cx18 *cx, struct tveeprom *tv) memset(tv, 0, sizeof(*tv)); - c = kzalloc(sizeof(*c), GFP_KERNEL); + c = kzalloc_obj(*c, GFP_KERNEL); if (!c) return; @@ -899,7 +899,7 @@ static int cx18_probe(struct pci_dev *pci_dev, return -ENOMEM; } - cx = kzalloc(sizeof(*cx), GFP_KERNEL); + cx = kzalloc_obj(*cx, GFP_KERNEL); if (!cx) return -ENOMEM; diff --git a/drivers/media/pci/cx18/cx18-fileops.c b/drivers/media/pci/cx18/cx18-fileops.c index 4944033dbb20..b3d3a6f67ea8 100644 --- a/drivers/media/pci/cx18/cx18-fileops.c +++ b/drivers/media/pci/cx18/cx18-fileops.c @@ -732,7 +732,7 @@ static int cx18_serialized_open(struct cx18_stream *s, struct file *filp) CX18_DEBUG_FILE("open %s\n", s->name); /* Allocate memory */ - item = kzalloc(sizeof(struct cx18_open_id), GFP_KERNEL); + item = kzalloc_obj(struct cx18_open_id, GFP_KERNEL); if (NULL == item) { CX18_DEBUG_WARN("nomem on v4l2 open\n"); return -ENOMEM; diff --git a/drivers/media/pci/cx18/cx18-queue.c b/drivers/media/pci/cx18/cx18-queue.c index eeb5513b1d52..04d6828f0259 100644 --- a/drivers/media/pci/cx18/cx18-queue.c +++ b/drivers/media/pci/cx18/cx18-queue.c @@ -361,12 +361,11 @@ int cx18_stream_alloc(struct cx18_stream *s) struct cx18_buffer *buf; /* 1 MDL per buffer to handle the worst & also default case */ - mdl = kzalloc(sizeof(struct cx18_mdl), GFP_KERNEL|__GFP_NOWARN); + mdl = kzalloc_obj(struct cx18_mdl, GFP_KERNEL | __GFP_NOWARN); if (mdl == NULL) break; - buf = kzalloc(sizeof(struct cx18_buffer), - GFP_KERNEL|__GFP_NOWARN); + buf = kzalloc_obj(struct cx18_buffer, GFP_KERNEL | __GFP_NOWARN); if (buf == NULL) { kfree(mdl); break; diff --git a/drivers/media/pci/cx18/cx18-streams.c b/drivers/media/pci/cx18/cx18-streams.c index 48203ba16387..b5b969fa9530 100644 --- a/drivers/media/pci/cx18/cx18-streams.c +++ b/drivers/media/pci/cx18/cx18-streams.c @@ -343,7 +343,7 @@ static int cx18_prep_dev(struct cx18 *cx, int type) /* Allocate the cx18_dvb struct only for the TS on cards with DTV */ if (type == CX18_ENC_STREAM_TYPE_TS) { if (cx->card->hw_all & CX18_HW_DVB) { - s->dvb = kzalloc(sizeof(struct cx18_dvb), GFP_KERNEL); + s->dvb = kzalloc_obj(struct cx18_dvb, GFP_KERNEL); if (s->dvb == NULL) { CX18_ERR("Couldn't allocate cx18_dvb structure for %s\n", s->name); diff --git a/drivers/media/pci/cx23885/altera-ci.c b/drivers/media/pci/cx23885/altera-ci.c index 0dc348215b72..7eae29e002ea 100644 --- a/drivers/media/pci/cx23885/altera-ci.c +++ b/drivers/media/pci/cx23885/altera-ci.c @@ -224,14 +224,14 @@ static struct fpga_inode *append_internal(struct fpga_internal *internal) struct fpga_inode *new_node = fpga_first_inode; if (new_node == NULL) { - new_node = kmalloc(sizeof(struct fpga_inode), GFP_KERNEL); + new_node = kmalloc_obj(struct fpga_inode, GFP_KERNEL); fpga_first_inode = new_node; } else { while (new_node->next_inode != NULL) new_node = new_node->next_inode; new_node->next_inode = - kmalloc(sizeof(struct fpga_inode), GFP_KERNEL); + kmalloc_obj(struct fpga_inode, GFP_KERNEL); if (new_node->next_inode != NULL) new_node = new_node->next_inode; else @@ -634,7 +634,7 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) struct fpga_internal *inter = NULL; int ret = 0; - pid_filt = kzalloc(sizeof(struct netup_hw_pid_filter), GFP_KERNEL); + pid_filt = kzalloc_obj(struct netup_hw_pid_filter, GFP_KERNEL); ci_dbg_print("%s\n", __func__); @@ -648,7 +648,7 @@ static int altera_hw_filt_init(struct altera_ci_config *config, int hw_filt_nr) (inter->filts_used)++; ci_dbg_print("%s: Find Internal Structure!\n", __func__); } else { - inter = kzalloc(sizeof(struct fpga_internal), GFP_KERNEL); + inter = kzalloc_obj(struct fpga_internal, GFP_KERNEL); if (!inter) { ret = -ENOMEM; goto err; @@ -706,7 +706,7 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) int ret = 0; u8 store = 0; - state = kzalloc(sizeof(struct altera_ci_state), GFP_KERNEL); + state = kzalloc_obj(struct altera_ci_state, GFP_KERNEL); ci_dbg_print("%s\n", __func__); @@ -721,7 +721,7 @@ int altera_ci_init(struct altera_ci_config *config, int ci_nr) inter->fpga_rw = config->fpga_rw; ci_dbg_print("%s: Find Internal Structure!\n", __func__); } else { - inter = kzalloc(sizeof(struct fpga_internal), GFP_KERNEL); + inter = kzalloc_obj(struct fpga_internal, GFP_KERNEL); if (!inter) { ret = -ENOMEM; goto err; diff --git a/drivers/media/pci/cx23885/cimax2.c b/drivers/media/pci/cx23885/cimax2.c index 06e41f92092d..f0ecc92fc444 100644 --- a/drivers/media/pci/cx23885/cimax2.c +++ b/drivers/media/pci/cx23885/cimax2.c @@ -451,7 +451,7 @@ int netup_ci_init(struct cx23885_tsport *port) int ret; ci_dbg_print("%s\n", __func__); - state = kzalloc(sizeof(struct netup_ci_state), GFP_KERNEL); + state = kzalloc_obj(struct netup_ci_state, GFP_KERNEL); if (!state) { ci_dbg_print("%s: Unable create CI structure!\n", __func__); ret = -ENOMEM; diff --git a/drivers/media/pci/cx23885/cx23885-alsa.c b/drivers/media/pci/cx23885/cx23885-alsa.c index 717fc6c9ef21..e56c5b7d84bc 100644 --- a/drivers/media/pci/cx23885/cx23885-alsa.c +++ b/drivers/media/pci/cx23885/cx23885-alsa.c @@ -374,7 +374,7 @@ static int snd_cx23885_hw_params(struct snd_pcm_substream *substream, BUG_ON(!chip->dma_size); BUG_ON(chip->num_periods & (chip->num_periods-1)); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (NULL == buf) return -ENOMEM; diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c index a39f445ce22a..ef2d00db794c 100644 --- a/drivers/media/pci/cx23885/cx23885-core.c +++ b/drivers/media/pci/cx23885/cx23885-core.c @@ -2124,7 +2124,7 @@ static int cx23885_initdev(struct pci_dev *pci_dev, struct v4l2_ctrl_handler *hdl; int err; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (NULL == dev) return -ENOMEM; diff --git a/drivers/media/pci/cx23885/cx23885-input.c b/drivers/media/pci/cx23885/cx23885-input.c index d2e84c6457e0..9c6e5b360bab 100644 --- a/drivers/media/pci/cx23885/cx23885-input.c +++ b/drivers/media/pci/cx23885/cx23885-input.c @@ -327,7 +327,7 @@ int cx23885_input_init(struct cx23885_dev *dev) } /* cx23885 board instance kernel IR state */ - kernel_ir = kzalloc(sizeof(struct cx23885_kernel_ir), GFP_KERNEL); + kernel_ir = kzalloc_obj(struct cx23885_kernel_ir, GFP_KERNEL); if (kernel_ir == NULL) return -ENOMEM; diff --git a/drivers/media/pci/cx23885/cx23888-ir.c b/drivers/media/pci/cx23885/cx23888-ir.c index 222d04421468..242b47a7d0af 100644 --- a/drivers/media/pci/cx23885/cx23888-ir.c +++ b/drivers/media/pci/cx23885/cx23888-ir.c @@ -1142,7 +1142,7 @@ int cx23888_ir_probe(struct cx23885_dev *dev) struct v4l2_subdev_ir_parameters default_params; int ret; - state = kzalloc(sizeof(struct cx23888_ir_state), GFP_KERNEL); + state = kzalloc_obj(struct cx23888_ir_state, GFP_KERNEL); if (state == NULL) return -ENOMEM; diff --git a/drivers/media/pci/cx25821/cx25821-alsa.c b/drivers/media/pci/cx25821/cx25821-alsa.c index f463365163b7..a8197a9b0abf 100644 --- a/drivers/media/pci/cx25821/cx25821-alsa.c +++ b/drivers/media/pci/cx25821/cx25821-alsa.c @@ -512,7 +512,7 @@ static int snd_cx25821_hw_params(struct snd_pcm_substream *substream, BUG_ON(!chip->dma_size); BUG_ON(chip->num_periods & (chip->num_periods - 1)); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (NULL == buf) return -ENOMEM; diff --git a/drivers/media/pci/cx25821/cx25821-core.c b/drivers/media/pci/cx25821/cx25821-core.c index a7336be44474..d64712f3aed4 100644 --- a/drivers/media/pci/cx25821/cx25821-core.c +++ b/drivers/media/pci/cx25821/cx25821-core.c @@ -1266,7 +1266,7 @@ static int cx25821_initdev(struct pci_dev *pci_dev, struct cx25821_dev *dev; int err = 0; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (NULL == dev) return -ENOMEM; diff --git a/drivers/media/pci/cx88/cx88-alsa.c b/drivers/media/pci/cx88/cx88-alsa.c index 4e574d8390b4..3b8622dd056c 100644 --- a/drivers/media/pci/cx88/cx88-alsa.c +++ b/drivers/media/pci/cx88/cx88-alsa.c @@ -465,7 +465,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream *substream, WARN_ON(!chip->dma_size); WARN_ON(chip->num_periods & (chip->num_periods - 1)); - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return -ENOMEM; diff --git a/drivers/media/pci/cx88/cx88-cards.c b/drivers/media/pci/cx88/cx88-cards.c index f01e48c23f8e..3e11bb066f31 100644 --- a/drivers/media/pci/cx88/cx88-cards.c +++ b/drivers/media/pci/cx88/cx88-cards.c @@ -3700,7 +3700,7 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) struct cx88_core *core; int i; - core = kzalloc(sizeof(*core), GFP_KERNEL); + core = kzalloc_obj(*core, GFP_KERNEL); if (!core) return NULL; diff --git a/drivers/media/pci/cx88/cx88-dsp.c b/drivers/media/pci/cx88/cx88-dsp.c index e378f3b215c7..1d7049edd252 100644 --- a/drivers/media/pci/cx88/cx88-dsp.c +++ b/drivers/media/pci/cx88/cx88-dsp.c @@ -252,7 +252,7 @@ static s16 *read_rds_samples(struct cx88_core *core, u32 *N) current_address, current_address - srch->fifo_start, sample_count, cx_read(MO_AUD_INTSTAT)); - samples = kmalloc_array(sample_count, sizeof(*samples), GFP_KERNEL); + samples = kmalloc_objs(*samples, sample_count, GFP_KERNEL); if (!samples) return NULL; diff --git a/drivers/media/pci/cx88/cx88-input.c b/drivers/media/pci/cx88/cx88-input.c index b9f2c14d62b4..f94d75c64cf9 100644 --- a/drivers/media/pci/cx88/cx88-input.c +++ b/drivers/media/pci/cx88/cx88-input.c @@ -267,7 +267,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) * used with a full-code IR table */ - ir = kzalloc(sizeof(*ir), GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); dev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !dev) goto err_out_free; diff --git a/drivers/media/pci/cx88/cx88-mpeg.c b/drivers/media/pci/cx88/cx88-mpeg.c index 2c1d5137ac47..1ed77f812784 100644 --- a/drivers/media/pci/cx88/cx88-mpeg.c +++ b/drivers/media/pci/cx88/cx88-mpeg.c @@ -619,7 +619,7 @@ int cx8802_register_driver(struct cx8802_driver *drv) dev->core->boardnr); /* Bring up a new struct for each driver instance */ - driver = kzalloc(sizeof(*drv), GFP_KERNEL); + driver = kzalloc_obj(*drv, GFP_KERNEL); if (!driver) { err = -ENOMEM; goto out; @@ -715,7 +715,7 @@ static int cx8802_probe(struct pci_dev *pci_dev, goto fail_core; err = -ENOMEM; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) goto fail_core; dev->pci = pci_dev; diff --git a/drivers/media/pci/cx88/cx88-video.c b/drivers/media/pci/cx88/cx88-video.c index 0c87327689d3..87752ce17df8 100644 --- a/drivers/media/pci/cx88/cx88-video.c +++ b/drivers/media/pci/cx88/cx88-video.c @@ -1261,7 +1261,7 @@ static int cx8800_initdev(struct pci_dev *pci_dev, int err; int i; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/pci/cx88/cx88-vp3054-i2c.c b/drivers/media/pci/cx88/cx88-vp3054-i2c.c index ac7f76dc5e21..e421589edf4c 100644 --- a/drivers/media/pci/cx88/cx88-vp3054-i2c.c +++ b/drivers/media/pci/cx88/cx88-vp3054-i2c.c @@ -97,7 +97,7 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) if (core->boardnr != CX88_BOARD_DNTV_LIVE_DVB_T_PRO) return 0; - vp3054_i2c = kzalloc(sizeof(*vp3054_i2c), GFP_KERNEL); + vp3054_i2c = kzalloc_obj(*vp3054_i2c, GFP_KERNEL); if (!vp3054_i2c) return -ENOMEM; dev->vp3054 = vp3054_i2c; diff --git a/drivers/media/pci/ddbridge/ddbridge-ci.c b/drivers/media/pci/ddbridge/ddbridge-ci.c index ee20813c33ff..2602256b9f4a 100644 --- a/drivers/media/pci/ddbridge/ddbridge-ci.c +++ b/drivers/media/pci/ddbridge/ddbridge-ci.c @@ -155,7 +155,7 @@ static void ci_attach(struct ddb_port *port) { struct ddb_ci *ci; - ci = kzalloc(sizeof(*ci), GFP_KERNEL); + ci = kzalloc_obj(*ci, GFP_KERNEL); if (!ci) return; memcpy(&ci->en, &en_templ, sizeof(en_templ)); @@ -288,7 +288,7 @@ static void ci_xo2_attach(struct ddb_port *port) { struct ddb_ci *ci; - ci = kzalloc(sizeof(*ci), GFP_KERNEL); + ci = kzalloc_obj(*ci, GFP_KERNEL); if (!ci) return; memcpy(&ci->en, &en_xo2_templ, sizeof(en_xo2_templ)); diff --git a/drivers/media/pci/ddbridge/ddbridge-dummy-fe.c b/drivers/media/pci/ddbridge/ddbridge-dummy-fe.c index 520ebd16b0c4..57192c5cb9c3 100644 --- a/drivers/media/pci/ddbridge/ddbridge-dummy-fe.c +++ b/drivers/media/pci/ddbridge/ddbridge-dummy-fe.c @@ -100,7 +100,7 @@ struct dvb_frontend *ddbridge_dummy_fe_qam_attach(void) struct ddbridge_dummy_fe_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct ddbridge_dummy_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct ddbridge_dummy_fe_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/pci/dm1105/dm1105.c b/drivers/media/pci/dm1105/dm1105.c index 9e9c7c071acc..1e1d4bda7c56 100644 --- a/drivers/media/pci/dm1105/dm1105.c +++ b/drivers/media/pci/dm1105/dm1105.c @@ -976,7 +976,7 @@ static int dm1105_probe(struct pci_dev *pdev, if (dm1105_devcount >= ARRAY_SIZE(card)) return -ENODEV; - dev = kzalloc(sizeof(struct dm1105_dev), GFP_KERNEL); + dev = kzalloc_obj(struct dm1105_dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu-bridge.c b/drivers/media/pci/intel/ipu-bridge.c index b2b710094914..72ebe4016ca2 100644 --- a/drivers/media/pci/intel/ipu-bridge.c +++ b/drivers/media/pci/intel/ipu-bridge.c @@ -638,7 +638,7 @@ int ipu_bridge_instantiate_vcm(struct device *sensor) return 0; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) { fwnode_handle_put(vcm_fwnode); return -ENOMEM; @@ -851,7 +851,7 @@ int ipu_bridge_init(struct device *dev, return dev_err_probe(dev, -EPROBE_DEFER, "waiting for IVSC to become ready\n"); - bridge = kzalloc(sizeof(*bridge), GFP_KERNEL); + bridge = kzalloc_obj(*bridge, GFP_KERNEL); if (!bridge) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6-bus.c b/drivers/media/pci/intel/ipu6/ipu6-bus.c index 5cee2748983b..59879e4861ed 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-bus.c +++ b/drivers/media/pci/intel/ipu6/ipu6-bus.c @@ -90,7 +90,7 @@ ipu6_bus_initialize_device(struct pci_dev *pdev, struct device *parent, struct ipu6_device *isp = pci_get_drvdata(pdev); int ret; - adev = kzalloc(sizeof(*adev), GFP_KERNEL); + adev = kzalloc_obj(*adev, GFP_KERNEL); if (!adev) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/pci/intel/ipu6/ipu6-buttress.c b/drivers/media/pci/intel/ipu6/ipu6-buttress.c index 103386c4f6ae..8b90ecf49e45 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-buttress.c +++ b/drivers/media/pci/intel/ipu6/ipu6-buttress.c @@ -552,7 +552,7 @@ int ipu6_buttress_map_fw_image(struct ipu6_bus_device *sys, n_pages = PFN_UP(fw->size); - pages = kmalloc_array(n_pages, sizeof(*pages), GFP_KERNEL); + pages = kmalloc_objs(*pages, n_pages, GFP_KERNEL); if (!pages) return -ENOMEM; diff --git a/drivers/media/pci/intel/ipu6/ipu6-dma.c b/drivers/media/pci/intel/ipu6/ipu6-dma.c index 7296373d36b0..cefb16040c21 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-dma.c +++ b/drivers/media/pci/intel/ipu6/ipu6-dma.c @@ -164,7 +164,7 @@ void *ipu6_dma_alloc(struct ipu6_bus_device *sys, size_t size, unsigned int i; int ret; - info = kzalloc(sizeof(*info), GFP_KERNEL); + info = kzalloc_obj(*info, GFP_KERNEL); if (!info) return NULL; diff --git a/drivers/media/pci/intel/ipu6/ipu6-fw-com.c b/drivers/media/pci/intel/ipu6/ipu6-fw-com.c index 40d8ce138a67..13ee09f6d32a 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-fw-com.c +++ b/drivers/media/pci/intel/ipu6/ipu6-fw-com.c @@ -170,7 +170,7 @@ void *ipu6_fw_com_prepare(struct ipu6_fw_com_cfg *cfg, if (!cfg || !cfg->cell_start || !cfg->cell_ready) return NULL; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return NULL; ctx->dmem_addr = base + cfg->dmem_addr + REGMEM_OFFSET; diff --git a/drivers/media/pci/intel/ipu6/ipu6-mmu.c b/drivers/media/pci/intel/ipu6/ipu6-mmu.c index 85cc6d5b4dd1..9eadde7142a3 100644 --- a/drivers/media/pci/intel/ipu6/ipu6-mmu.c +++ b/drivers/media/pci/intel/ipu6/ipu6-mmu.c @@ -549,7 +549,7 @@ static struct ipu6_mmu_info *ipu6_mmu_alloc(struct ipu6_device *isp) struct ipu6_mmu_info *mmu_info; int ret; - mmu_info = kzalloc(sizeof(*mmu_info), GFP_KERNEL); + mmu_info = kzalloc_obj(*mmu_info, GFP_KERNEL); if (!mmu_info) return NULL; @@ -613,7 +613,7 @@ static struct ipu6_dma_mapping *alloc_dma_mapping(struct ipu6_device *isp) { struct ipu6_dma_mapping *dmap; - dmap = kzalloc(sizeof(*dmap), GFP_KERNEL); + dmap = kzalloc_obj(*dmap, GFP_KERNEL); if (!dmap) return NULL; diff --git a/drivers/media/pci/intel/ipu6/ipu6.c b/drivers/media/pci/intel/ipu6/ipu6.c index 24238f8311a6..57fe13ebb621 100644 --- a/drivers/media/pci/intel/ipu6/ipu6.c +++ b/drivers/media/pci/intel/ipu6/ipu6.c @@ -381,7 +381,7 @@ ipu6_isys_init(struct pci_dev *pdev, struct device *parent, return ERR_PTR(ret); } - pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); + pdata = kzalloc_obj(*pdata, GFP_KERNEL); if (!pdata) return ERR_PTR(-ENOMEM); @@ -425,7 +425,7 @@ ipu6_psys_init(struct pci_dev *pdev, struct device *parent, struct ipu6_psys_pdata *pdata; int ret; - pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); + pdata = kzalloc_obj(*pdata, GFP_KERNEL); if (!pdata) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/pci/ivtv/ivtv-alsa-main.c b/drivers/media/pci/ivtv/ivtv-alsa-main.c index 9e13a7128a53..05d499241c02 100644 --- a/drivers/media/pci/ivtv/ivtv-alsa-main.c +++ b/drivers/media/pci/ivtv/ivtv-alsa-main.c @@ -74,7 +74,7 @@ static int snd_ivtv_card_create(struct v4l2_device *v4l2_dev, struct snd_card *sc, struct snd_ivtv_card **itvsc) { - *itvsc = kzalloc(sizeof(struct snd_ivtv_card), GFP_KERNEL); + *itvsc = kzalloc_obj(struct snd_ivtv_card, GFP_KERNEL); if (*itvsc == NULL) return -ENOMEM; diff --git a/drivers/media/pci/ivtv/ivtv-driver.c b/drivers/media/pci/ivtv/ivtv-driver.c index 459eb6cc370c..9d0d4faf9867 100644 --- a/drivers/media/pci/ivtv/ivtv-driver.c +++ b/drivers/media/pci/ivtv/ivtv-driver.c @@ -953,7 +953,7 @@ static int ivtv_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) int vbi_buf_size; struct ivtv *itv; - itv = kzalloc(sizeof(struct ivtv), GFP_KERNEL); + itv = kzalloc_obj(struct ivtv, GFP_KERNEL); if (itv == NULL) return -ENOMEM; itv->pdev = pdev; diff --git a/drivers/media/pci/ivtv/ivtv-fileops.c b/drivers/media/pci/ivtv/ivtv-fileops.c index ef9ec062c03a..87c0ef449beb 100644 --- a/drivers/media/pci/ivtv/ivtv-fileops.c +++ b/drivers/media/pci/ivtv/ivtv-fileops.c @@ -990,7 +990,7 @@ static int ivtv_open(struct file *filp) } /* Allocate memory */ - item = kzalloc(sizeof(struct ivtv_open_id), GFP_KERNEL); + item = kzalloc_obj(struct ivtv_open_id, GFP_KERNEL); if (NULL == item) { IVTV_DEBUG_WARN("nomem on v4l2 open\n"); return -ENOMEM; diff --git a/drivers/media/pci/ivtv/ivtv-queue.c b/drivers/media/pci/ivtv/ivtv-queue.c index f7d2d159d800..9e339ef0c82d 100644 --- a/drivers/media/pci/ivtv/ivtv-queue.c +++ b/drivers/media/pci/ivtv/ivtv-queue.c @@ -207,8 +207,8 @@ int ivtv_stream_alloc(struct ivtv_stream *s) } s->sg_processing_size = 0; - s->sg_dma = kzalloc(sizeof(struct ivtv_sg_element), - GFP_KERNEL|__GFP_NOWARN); + s->sg_dma = kzalloc_obj(struct ivtv_sg_element, + GFP_KERNEL | __GFP_NOWARN); if (s->sg_dma == NULL) { IVTV_ERR("Could not allocate sg_dma for %s stream\n", s->name); kfree(s->sg_pending); @@ -226,8 +226,8 @@ int ivtv_stream_alloc(struct ivtv_stream *s) /* allocate stream buffers. Initially all buffers are in q_free. */ for (i = 0; i < s->buffers; i++) { - struct ivtv_buffer *buf = kzalloc(sizeof(struct ivtv_buffer), - GFP_KERNEL|__GFP_NOWARN); + struct ivtv_buffer *buf = kzalloc_obj(struct ivtv_buffer, + GFP_KERNEL | __GFP_NOWARN); if (buf == NULL) break; diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 90c584cf97c2..4f55b44738c9 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1176,8 +1176,7 @@ static int ivtvfb_init_card(struct ivtv *itv) return -EBUSY; } - itv->osd_info = kzalloc(sizeof(struct osd_info), - GFP_KERNEL|__GFP_NOWARN); + itv->osd_info = kzalloc_obj(struct osd_info, GFP_KERNEL | __GFP_NOWARN); if (itv->osd_info == NULL) { IVTVFB_ERR("Failed to allocate memory for osd_info\n"); return -ENOMEM; diff --git a/drivers/media/pci/mantis/hopper_cards.c b/drivers/media/pci/mantis/hopper_cards.c index b85aef4e2b24..132b5e21868b 100644 --- a/drivers/media/pci/mantis/hopper_cards.c +++ b/drivers/media/pci/mantis/hopper_cards.c @@ -149,7 +149,7 @@ static int hopper_pci_probe(struct pci_dev *pdev, struct mantis_hwconfig *config; int err; - mantis = kzalloc(sizeof(*mantis), GFP_KERNEL); + mantis = kzalloc_obj(*mantis, GFP_KERNEL); if (!mantis) { err = -ENOMEM; goto fail0; diff --git a/drivers/media/pci/mantis/mantis_ca.c b/drivers/media/pci/mantis/mantis_ca.c index 0fad0a923e35..a0998b16ba9e 100644 --- a/drivers/media/pci/mantis/mantis_ca.c +++ b/drivers/media/pci/mantis/mantis_ca.c @@ -137,7 +137,7 @@ int mantis_ca_init(struct mantis_pci *mantis) int ca_flags = 0, result; dprintk(MANTIS_DEBUG, 1, "Initializing Mantis CA"); - ca = kzalloc(sizeof(struct mantis_ca), GFP_KERNEL); + ca = kzalloc_obj(struct mantis_ca, GFP_KERNEL); if (!ca) { dprintk(MANTIS_ERROR, 1, "Out of memory!, exiting .."); result = -ENOMEM; diff --git a/drivers/media/pci/mantis/mantis_cards.c b/drivers/media/pci/mantis/mantis_cards.c index b44b4cf42f86..3c46e1db8e4a 100644 --- a/drivers/media/pci/mantis/mantis_cards.c +++ b/drivers/media/pci/mantis/mantis_cards.c @@ -158,7 +158,7 @@ static int mantis_pci_probe(struct pci_dev *pdev, struct mantis_hwconfig *config; int err; - mantis = kzalloc(sizeof(*mantis), GFP_KERNEL); + mantis = kzalloc_obj(*mantis, GFP_KERNEL); if (!mantis) return -ENOMEM; diff --git a/drivers/media/pci/mgb4/mgb4_core.c b/drivers/media/pci/mgb4/mgb4_core.c index a7cb8dc50b53..cd23758fb9b4 100644 --- a/drivers/media/pci/mgb4/mgb4_core.c +++ b/drivers/media/pci/mgb4/mgb4_core.c @@ -522,7 +522,7 @@ static int mgb4_probe(struct pci_dev *pdev, const struct pci_device_id *id) }; int irqs = pci_msix_vec_count(pdev); - mgbdev = kzalloc(sizeof(*mgbdev), GFP_KERNEL); + mgbdev = kzalloc_obj(*mgbdev, GFP_KERNEL); if (!mgbdev) return -ENOMEM; diff --git a/drivers/media/pci/mgb4/mgb4_vin.c b/drivers/media/pci/mgb4/mgb4_vin.c index e782db79686f..815c87b9210f 100644 --- a/drivers/media/pci/mgb4/mgb4_vin.c +++ b/drivers/media/pci/mgb4/mgb4_vin.c @@ -946,7 +946,7 @@ struct mgb4_vin_dev *mgb4_vin_create(struct mgb4_dev *mgbdev, int id) struct device *dev = &pdev->dev; int vin_irq, err_irq; - vindev = kzalloc(sizeof(*vindev), GFP_KERNEL); + vindev = kzalloc_obj(*vindev, GFP_KERNEL); if (!vindev) return NULL; diff --git a/drivers/media/pci/mgb4/mgb4_vout.c b/drivers/media/pci/mgb4/mgb4_vout.c index 44e9565d4d06..cd5a36a41333 100644 --- a/drivers/media/pci/mgb4/mgb4_vout.c +++ b/drivers/media/pci/mgb4/mgb4_vout.c @@ -761,7 +761,7 @@ struct mgb4_vout_dev *mgb4_vout_create(struct mgb4_dev *mgbdev, int id) struct pci_dev *pdev = mgbdev->pdev; struct device *dev = &pdev->dev; - voutdev = kzalloc(sizeof(*voutdev), GFP_KERNEL); + voutdev = kzalloc_obj(*voutdev, GFP_KERNEL); if (!voutdev) return NULL; diff --git a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c index 9f2ac33cffa7..08af6717b1c9 100644 --- a/drivers/media/pci/netup_unidvb/netup_unidvb_core.c +++ b/drivers/media/pci/netup_unidvb/netup_unidvb_core.c @@ -799,7 +799,7 @@ static int netup_unidvb_initdev(struct pci_dev *pci_dev, } /* allocate device context */ - ndev = kzalloc(sizeof(*ndev), GFP_KERNEL); + ndev = kzalloc_obj(*ndev, GFP_KERNEL); if (!ndev) goto dev_alloc_err; diff --git a/drivers/media/pci/pluto2/pluto2.c b/drivers/media/pci/pluto2/pluto2.c index 6ac9b9bd7435..38bd167e821d 100644 --- a/drivers/media/pci/pluto2/pluto2.c +++ b/drivers/media/pci/pluto2/pluto2.c @@ -582,7 +582,7 @@ static int pluto2_probe(struct pci_dev *pdev, const struct pci_device_id *ent) struct dmx_demux *dmx; int ret = -ENOMEM; - pluto = kzalloc(sizeof(struct pluto), GFP_KERNEL); + pluto = kzalloc_obj(struct pluto, GFP_KERNEL); if (!pluto) goto out; diff --git a/drivers/media/pci/pt1/pt1.c b/drivers/media/pci/pt1/pt1.c index 1ced093583ac..21a9a3166588 100644 --- a/drivers/media/pci/pt1/pt1.c +++ b/drivers/media/pci/pt1/pt1.c @@ -833,7 +833,7 @@ pt1_alloc_adapter(struct pt1 *pt1) struct dmxdev *dmxdev; int ret; - adap = kzalloc(sizeof(struct pt1_adapter), GFP_KERNEL); + adap = kzalloc_obj(struct pt1_adapter, GFP_KERNEL); if (!adap) { ret = -ENOMEM; goto err; @@ -1356,7 +1356,7 @@ static int pt1_probe(struct pci_dev *pdev, const struct pci_device_id *ent) goto err_pci_release_regions; } - pt1 = kzalloc(sizeof(struct pt1), GFP_KERNEL); + pt1 = kzalloc_obj(struct pt1, GFP_KERNEL); if (!pt1) { ret = -ENOMEM; goto err_pci_iounmap; diff --git a/drivers/media/pci/pt3/pt3.c b/drivers/media/pci/pt3/pt3.c index c55aa782b72c..f0fb92017e8f 100644 --- a/drivers/media/pci/pt3/pt3.c +++ b/drivers/media/pci/pt3/pt3.c @@ -529,7 +529,7 @@ static int pt3_alloc_adapter(struct pt3_board *pt3, int index) struct pt3_adapter *adap; struct dvb_adapter *da; - adap = kzalloc(sizeof(*adap), GFP_KERNEL); + adap = kzalloc_obj(*adap, GFP_KERNEL); if (!adap) return -ENOMEM; diff --git a/drivers/media/pci/saa7134/saa7134-alsa.c b/drivers/media/pci/saa7134/saa7134-alsa.c index f86a44dfe6e3..ad1a640d7f76 100644 --- a/drivers/media/pci/saa7134/saa7134-alsa.c +++ b/drivers/media/pci/saa7134/saa7134-alsa.c @@ -816,7 +816,7 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) mutex_unlock(&dev->dmasound.lock); - pcm = kzalloc(sizeof(*pcm), GFP_KERNEL); + pcm = kzalloc_obj(*pcm, GFP_KERNEL); if (pcm == NULL) return -ENOMEM; diff --git a/drivers/media/pci/saa7134/saa7134-core.c b/drivers/media/pci/saa7134/saa7134-core.c index 537aa65acdc8..5acad9554a61 100644 --- a/drivers/media/pci/saa7134/saa7134-core.c +++ b/drivers/media/pci/saa7134/saa7134-core.c @@ -1010,7 +1010,7 @@ static int saa7134_initdev(struct pci_dev *pci_dev, if (saa7134_devcount == SAA7134_MAXBOARDS) return -ENOMEM; - dev = kzalloc(sizeof(*dev),GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (NULL == dev) return -ENOMEM; @@ -1018,7 +1018,7 @@ static int saa7134_initdev(struct pci_dev *pci_dev, sprintf(dev->name, "saa%x[%d]", pci_dev->device, dev->nr); #ifdef CONFIG_MEDIA_CONTROLLER - dev->media_dev = kzalloc(sizeof(*dev->media_dev), GFP_KERNEL); + dev->media_dev = kzalloc_obj(*dev->media_dev, GFP_KERNEL); if (!dev->media_dev) { err = -ENOMEM; goto err_free_dev; diff --git a/drivers/media/pci/saa7134/saa7134-go7007.c b/drivers/media/pci/saa7134/saa7134-go7007.c index bd37db5ce363..05f9606b9012 100644 --- a/drivers/media/pci/saa7134/saa7134-go7007.c +++ b/drivers/media/pci/saa7134/saa7134-go7007.c @@ -414,7 +414,7 @@ static int saa7134_go7007_init(struct saa7134_dev *dev) if (go == NULL) return -ENOMEM; - saa = kzalloc(sizeof(struct saa7134_go7007), GFP_KERNEL); + saa = kzalloc_obj(struct saa7134_go7007, GFP_KERNEL); if (saa == NULL) { kfree(go); return -ENOMEM; diff --git a/drivers/media/pci/saa7134/saa7134-input.c b/drivers/media/pci/saa7134/saa7134-input.c index 468dbe8d552f..22fbcc2cb585 100644 --- a/drivers/media/pci/saa7134/saa7134-input.c +++ b/drivers/media/pci/saa7134/saa7134-input.c @@ -768,7 +768,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) return -ENODEV; } - ir = kzalloc(sizeof(*ir), GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ir || !rc) { err = -ENOMEM; diff --git a/drivers/media/pci/saa7146/hexium_gemini.c b/drivers/media/pci/saa7146/hexium_gemini.c index 40b35098f3ea..371beecd92e1 100644 --- a/drivers/media/pci/saa7146/hexium_gemini.c +++ b/drivers/media/pci/saa7146/hexium_gemini.c @@ -250,7 +250,7 @@ static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d DEB_EE("\n"); - hexium = kzalloc(sizeof(*hexium), GFP_KERNEL); + hexium = kzalloc_obj(*hexium, GFP_KERNEL); if (!hexium) return -ENOMEM; diff --git a/drivers/media/pci/saa7146/hexium_orion.c b/drivers/media/pci/saa7146/hexium_orion.c index a2076728c621..f713d543971e 100644 --- a/drivers/media/pci/saa7146/hexium_orion.c +++ b/drivers/media/pci/saa7146/hexium_orion.c @@ -209,7 +209,7 @@ static int hexium_probe(struct saa7146_dev *dev) return -EFAULT; } - hexium = kzalloc(sizeof(*hexium), GFP_KERNEL); + hexium = kzalloc_obj(*hexium, GFP_KERNEL); if (!hexium) return -ENOMEM; diff --git a/drivers/media/pci/saa7146/mxb.c b/drivers/media/pci/saa7146/mxb.c index a14b839098b8..1999d45f2986 100644 --- a/drivers/media/pci/saa7146/mxb.c +++ b/drivers/media/pci/saa7146/mxb.c @@ -226,7 +226,7 @@ static int mxb_probe(struct saa7146_dev *dev) V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); if (hdl->error) return hdl->error; - mxb = kzalloc(sizeof(struct mxb), GFP_KERNEL); + mxb = kzalloc_obj(struct mxb, GFP_KERNEL); if (mxb == NULL) { DEB_D("not enough kernel memory\n"); return -ENOMEM; diff --git a/drivers/media/pci/saa7164/saa7164-buffer.c b/drivers/media/pci/saa7164/saa7164-buffer.c index 7820e4f47fd5..9d1fa04990f7 100644 --- a/drivers/media/pci/saa7164/saa7164-buffer.c +++ b/drivers/media/pci/saa7164/saa7164-buffer.c @@ -68,7 +68,7 @@ struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port, goto ret; } - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) goto ret; @@ -252,7 +252,7 @@ struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, { struct saa7164_user_buffer *buf; - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) return NULL; diff --git a/drivers/media/pci/saa7164/saa7164-core.c b/drivers/media/pci/saa7164/saa7164-core.c index a8a004f28ca0..eac9bc9f640c 100644 --- a/drivers/media/pci/saa7164/saa7164-core.c +++ b/drivers/media/pci/saa7164/saa7164-core.c @@ -1238,7 +1238,7 @@ static int saa7164_initdev(struct pci_dev *pci_dev, int err, i; u32 version; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (NULL == dev) return -ENOMEM; diff --git a/drivers/media/pci/saa7164/saa7164-encoder.c b/drivers/media/pci/saa7164/saa7164-encoder.c index 66d650b5f69a..cae31f11d076 100644 --- a/drivers/media/pci/saa7164/saa7164-encoder.c +++ b/drivers/media/pci/saa7164/saa7164-encoder.c @@ -719,7 +719,7 @@ static int fops_open(struct file *file) dprintk(DBGLVL_ENC, "%s()\n", __func__); /* allocate + initialize per filehandle data */ - fh = kzalloc(sizeof(*fh), GFP_KERNEL); + fh = kzalloc_obj(*fh, GFP_KERNEL); if (NULL == fh) return -ENOMEM; diff --git a/drivers/media/pci/saa7164/saa7164-vbi.c b/drivers/media/pci/saa7164/saa7164-vbi.c index 57e4362c0d19..fcb9f99890e5 100644 --- a/drivers/media/pci/saa7164/saa7164-vbi.c +++ b/drivers/media/pci/saa7164/saa7164-vbi.c @@ -422,7 +422,7 @@ static int fops_open(struct file *file) dprintk(DBGLVL_VBI, "%s()\n", __func__); /* allocate + initialize per filehandle data */ - fh = kzalloc(sizeof(*fh), GFP_KERNEL); + fh = kzalloc_obj(*fh, GFP_KERNEL); if (NULL == fh) return -ENOMEM; diff --git a/drivers/media/pci/smipcie/smipcie-main.c b/drivers/media/pci/smipcie/smipcie-main.c index 7db6d443fc54..5bfba2721231 100644 --- a/drivers/media/pci/smipcie/smipcie-main.c +++ b/drivers/media/pci/smipcie/smipcie-main.c @@ -946,7 +946,7 @@ static int smi_probe(struct pci_dev *pdev, const struct pci_device_id *id) if (pci_enable_device(pdev) < 0) return -ENODEV; - dev = kzalloc(sizeof(struct smi_dev), GFP_KERNEL); + dev = kzalloc_obj(struct smi_dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err_pci_disable_device; diff --git a/drivers/media/pci/solo6x10/solo6x10-core.c b/drivers/media/pci/solo6x10/solo6x10-core.c index d1d3a83d0122..78335a6838c6 100644 --- a/drivers/media/pci/solo6x10/solo6x10-core.c +++ b/drivers/media/pci/solo6x10/solo6x10-core.c @@ -449,7 +449,7 @@ static int solo_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) int ret; u8 chip_id; - solo_dev = kzalloc(sizeof(*solo_dev), GFP_KERNEL); + solo_dev = kzalloc_obj(*solo_dev, GFP_KERNEL); if (solo_dev == NULL) return -ENOMEM; diff --git a/drivers/media/pci/solo6x10/solo6x10-g723.c b/drivers/media/pci/solo6x10/solo6x10-g723.c index 1db9f40ee0c0..5906fd47b583 100644 --- a/drivers/media/pci/solo6x10/solo6x10-g723.c +++ b/drivers/media/pci/solo6x10/solo6x10-g723.c @@ -120,7 +120,7 @@ static int snd_solo_pcm_open(struct snd_pcm_substream *ss) struct solo_dev *solo_dev = snd_pcm_substream_chip(ss); struct solo_snd_pcm *solo_pcm; - solo_pcm = kzalloc(sizeof(*solo_pcm), GFP_KERNEL); + solo_pcm = kzalloc_obj(*solo_pcm, GFP_KERNEL); if (solo_pcm == NULL) goto oom; diff --git a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c index 5ee59b3844cc..d7168b9c9e61 100644 --- a/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c +++ b/drivers/media/pci/solo6x10/solo6x10-v4l2-enc.c @@ -1208,7 +1208,7 @@ static struct solo_enc_dev *solo_enc_alloc(struct solo_dev *solo_dev, struct v4l2_ctrl_handler *hdl; int ret; - solo_enc = kzalloc(sizeof(*solo_enc), GFP_KERNEL); + solo_enc = kzalloc_obj(*solo_enc, GFP_KERNEL); if (!solo_enc) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/pci/ttpci/budget-av.c b/drivers/media/pci/ttpci/budget-av.c index 69f5e810f9b5..482e71c0fdcc 100644 --- a/drivers/media/pci/ttpci/budget-av.c +++ b/drivers/media/pci/ttpci/budget-av.c @@ -1437,7 +1437,7 @@ static int budget_av_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio dprintk(2, "dev: %p\n", dev); - budget_av = kzalloc(sizeof(struct budget_av), GFP_KERNEL); + budget_av = kzalloc_obj(struct budget_av, GFP_KERNEL); if (!budget_av) return -ENOMEM; diff --git a/drivers/media/pci/ttpci/budget-ci.c b/drivers/media/pci/ttpci/budget-ci.c index 33f08adf4feb..86edb4310366 100644 --- a/drivers/media/pci/ttpci/budget-ci.c +++ b/drivers/media/pci/ttpci/budget-ci.c @@ -1456,7 +1456,7 @@ static int budget_ci_attach(struct saa7146_dev *dev, struct saa7146_pci_extensio struct budget_ci *budget_ci; int err; - budget_ci = kzalloc(sizeof(struct budget_ci), GFP_KERNEL); + budget_ci = kzalloc_obj(struct budget_ci, GFP_KERNEL); if (!budget_ci) { err = -ENOMEM; goto out1; diff --git a/drivers/media/pci/ttpci/budget.c b/drivers/media/pci/ttpci/budget.c index f623c250909b..ebdc6d2bce4e 100644 --- a/drivers/media/pci/ttpci/budget.c +++ b/drivers/media/pci/ttpci/budget.c @@ -788,7 +788,7 @@ static int budget_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_d struct budget *budget = NULL; int err; - budget = kmalloc(sizeof(struct budget), GFP_KERNEL); + budget = kmalloc_obj(struct budget, GFP_KERNEL); if (budget == NULL) return -ENOMEM; diff --git a/drivers/media/pci/tw686x/tw686x-core.c b/drivers/media/pci/tw686x/tw686x-core.c index f39e0e34deb6..bcf93f4a5c83 100644 --- a/drivers/media/pci/tw686x/tw686x-core.c +++ b/drivers/media/pci/tw686x/tw686x-core.c @@ -243,22 +243,22 @@ static int tw686x_probe(struct pci_dev *pci_dev, struct tw686x_dev *dev; int err; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; dev->type = pci_id->driver_data; dev->dma_mode = dma_mode; sprintf(dev->name, "tw%04X", pci_dev->device); - dev->video_channels = kcalloc(max_channels(dev), - sizeof(*dev->video_channels), GFP_KERNEL); + dev->video_channels = kzalloc_objs(*dev->video_channels, + max_channels(dev), GFP_KERNEL); if (!dev->video_channels) { err = -ENOMEM; goto free_dev; } - dev->audio_channels = kcalloc(max_channels(dev), - sizeof(*dev->audio_channels), GFP_KERNEL); + dev->audio_channels = kzalloc_objs(*dev->audio_channels, + max_channels(dev), GFP_KERNEL); if (!dev->audio_channels) { err = -ENOMEM; goto free_video; diff --git a/drivers/media/pci/zoran/videocodec.c b/drivers/media/pci/zoran/videocodec.c index 8efc5e06b0f7..2874247ad300 100644 --- a/drivers/media/pci/zoran/videocodec.c +++ b/drivers/media/pci/zoran/videocodec.c @@ -73,7 +73,7 @@ struct videocodec *videocodec_attach(struct videocodec_master *master) res = codec->setup(codec); if (res == 0) { zrdev_dbg(zr, "%s: '%s'\n", __func__, codec->name); - ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + ptr = kzalloc_obj(*ptr, GFP_KERNEL); if (!ptr) goto out_kfree; ptr->codec = codec; @@ -180,7 +180,7 @@ int videocodec_register(const struct videocodec *codec) "videocodec: register '%s', type: %x, flags %lx, magic %lx\n", codec->name, codec->type, codec->flags, codec->magic); - ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + ptr = kzalloc_obj(*ptr, GFP_KERNEL); if (!ptr) return -ENOMEM; ptr->codec = codec; diff --git a/drivers/media/pci/zoran/zr36016.c b/drivers/media/pci/zoran/zr36016.c index d2e136c48a1b..4c6a0a00578b 100644 --- a/drivers/media/pci/zoran/zr36016.c +++ b/drivers/media/pci/zoran/zr36016.c @@ -344,7 +344,7 @@ static int zr36016_setup(struct videocodec *codec) return -ENOSPC; } //mem structure init - ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + ptr = kzalloc_obj(*ptr, GFP_KERNEL); codec->data = ptr; if (!ptr) return -ENOMEM; diff --git a/drivers/media/pci/zoran/zr36050.c b/drivers/media/pci/zoran/zr36050.c index c17965073557..701e4ef7ec22 100644 --- a/drivers/media/pci/zoran/zr36050.c +++ b/drivers/media/pci/zoran/zr36050.c @@ -741,7 +741,7 @@ static int zr36050_setup(struct videocodec *codec) return -ENOSPC; } //mem structure init - ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + ptr = kzalloc_obj(*ptr, GFP_KERNEL); codec->data = ptr; if (!ptr) return -ENOMEM; diff --git a/drivers/media/pci/zoran/zr36060.c b/drivers/media/pci/zoran/zr36060.c index d6c12efc5bb6..ddd822e4495a 100644 --- a/drivers/media/pci/zoran/zr36060.c +++ b/drivers/media/pci/zoran/zr36060.c @@ -796,7 +796,7 @@ static int zr36060_setup(struct videocodec *codec) return -ENOSPC; } //mem structure init - ptr = kzalloc(sizeof(*ptr), GFP_KERNEL); + ptr = kzalloc_obj(*ptr, GFP_KERNEL); codec->data = ptr; if (!ptr) return -ENOMEM; diff --git a/drivers/media/platform/allegro-dvt/allegro-core.c b/drivers/media/platform/allegro-dvt/allegro-core.c index eec0b8b30b7f..a6589cd6359e 100644 --- a/drivers/media/platform/allegro-dvt/allegro-core.c +++ b/drivers/media/platform/allegro-dvt/allegro-core.c @@ -967,7 +967,7 @@ static int allegro_mbox_notify(struct allegro_mbox *mbox) u32 *tmp; int err; - msg = kmalloc(sizeof(*msg), GFP_KERNEL); + msg = kmalloc_obj(*msg, GFP_KERNEL); if (!msg) return -ENOMEM; @@ -1551,7 +1551,7 @@ static int allocate_buffers_internal(struct allegro_channel *channel, struct allegro_buffer *buffer, *tmp; for (i = 0; i < n; i++) { - buffer = kmalloc(sizeof(*buffer), GFP_KERNEL); + buffer = kmalloc_obj(*buffer, GFP_KERNEL); if (!buffer) { err = -ENOMEM; goto err; @@ -1632,7 +1632,7 @@ static ssize_t allegro_h264_write_sps(struct allegro_channel *channel, unsigned int cpb_size; unsigned int cpb_size_scale; - sps = kzalloc(sizeof(*sps), GFP_KERNEL); + sps = kzalloc_obj(*sps, GFP_KERNEL); if (!sps) return -ENOMEM; @@ -1729,7 +1729,7 @@ static ssize_t allegro_h264_write_pps(struct allegro_channel *channel, struct nal_h264_pps *pps; ssize_t size; - pps = kzalloc(sizeof(*pps), GFP_KERNEL); + pps = kzalloc_obj(*pps, GFP_KERNEL); if (!pps) return -ENOMEM; @@ -1780,7 +1780,7 @@ static ssize_t allegro_hevc_write_vps(struct allegro_channel *channel, s32 level = v4l2_ctrl_g_ctrl(channel->mpeg_video_hevc_level); s32 tier = v4l2_ctrl_g_ctrl(channel->mpeg_video_hevc_tier); - vps = kzalloc(sizeof(*vps), GFP_KERNEL); + vps = kzalloc_obj(*vps, GFP_KERNEL); if (!vps) return -ENOMEM; @@ -1822,7 +1822,7 @@ static ssize_t allegro_hevc_write_sps(struct allegro_channel *channel, s32 level = v4l2_ctrl_g_ctrl(channel->mpeg_video_hevc_level); s32 tier = v4l2_ctrl_g_ctrl(channel->mpeg_video_hevc_tier); - sps = kzalloc(sizeof(*sps), GFP_KERNEL); + sps = kzalloc_obj(*sps, GFP_KERNEL); if (!sps) return -ENOMEM; @@ -1929,7 +1929,7 @@ static ssize_t allegro_hevc_write_pps(struct allegro_channel *channel, ssize_t size; int i; - pps = kzalloc(sizeof(*pps), GFP_KERNEL); + pps = kzalloc_obj(*pps, GFP_KERNEL); if (!pps) return -ENOMEM; diff --git a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c index c51c6f4e41dc..0b499ed7795f 100644 --- a/drivers/media/platform/amlogic/meson-ge2d/ge2d.c +++ b/drivers/media/platform/amlogic/meson-ge2d/ge2d.c @@ -834,7 +834,7 @@ static int ge2d_open(struct file *file) struct ge2d_ctx *ctx = NULL; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->ge2d = ge2d; diff --git a/drivers/media/platform/amphion/vdec.c b/drivers/media/platform/amphion/vdec.c index adf53b49020e..3302994dbf3f 100644 --- a/drivers/media/platform/amphion/vdec.c +++ b/drivers/media/platform/amphion/vdec.c @@ -1927,19 +1927,18 @@ static int vdec_open(struct file *file) struct vdec_t *vdec; int ret; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; - vdec = kzalloc(sizeof(*vdec), GFP_KERNEL); + vdec = kzalloc_obj(*vdec, GFP_KERNEL); if (!vdec) { kfree(inst); return -ENOMEM; } - vdec->slots = kmalloc_array(VDEC_SLOT_CNT_DFT, - sizeof(*vdec->slots), - GFP_KERNEL | __GFP_ZERO); + vdec->slots = kmalloc_objs(*vdec->slots, VDEC_SLOT_CNT_DFT, + GFP_KERNEL | __GFP_ZERO); if (!vdec->slots) { kfree(vdec); kfree(inst); diff --git a/drivers/media/platform/amphion/venc.c b/drivers/media/platform/amphion/venc.c index 9e5cbc2b0d3f..4f13566fed49 100644 --- a/drivers/media/platform/amphion/venc.c +++ b/drivers/media/platform/amphion/venc.c @@ -858,7 +858,7 @@ static int venc_frame_encoded(struct vpu_inst *inst, void *arg) if (!info) return -EINVAL; venc = inst->priv; - frame = kzalloc(sizeof(*frame), GFP_KERNEL); + frame = kzalloc_obj(*frame, GFP_KERNEL); if (!frame) return -ENOMEM; @@ -1307,11 +1307,11 @@ static int venc_open(struct file *file) struct venc_t *venc; int ret; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; - venc = kzalloc(sizeof(*venc), GFP_KERNEL); + venc = kzalloc_obj(*venc, GFP_KERNEL); if (!venc) { kfree(inst); return -ENOMEM; diff --git a/drivers/media/platform/amphion/vpu_cmds.c b/drivers/media/platform/amphion/vpu_cmds.c index ab69412e0aa7..00eda558a739 100644 --- a/drivers/media/platform/amphion/vpu_cmds.c +++ b/drivers/media/platform/amphion/vpu_cmds.c @@ -83,11 +83,11 @@ static struct vpu_cmd_t *vpu_alloc_cmd(struct vpu_inst *inst, u32 id, void *data int i; int ret; - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) return NULL; - cmd->pkt = kzalloc(sizeof(*cmd->pkt), GFP_KERNEL); + cmd->pkt = kzalloc_obj(*cmd->pkt, GFP_KERNEL); if (!cmd->pkt) { kfree(cmd); return NULL; diff --git a/drivers/media/platform/broadcom/bcm2835-unicam.c b/drivers/media/platform/broadcom/bcm2835-unicam.c index f10064107d54..9d00ea315763 100644 --- a/drivers/media/platform/broadcom/bcm2835-unicam.c +++ b/drivers/media/platform/broadcom/bcm2835-unicam.c @@ -2642,7 +2642,7 @@ static int unicam_probe(struct platform_device *pdev) struct unicam_device *unicam; int ret; - unicam = kzalloc(sizeof(*unicam), GFP_KERNEL); + unicam = kzalloc_obj(*unicam, GFP_KERNEL); if (!unicam) return -ENOMEM; diff --git a/drivers/media/platform/cadence/cdns-csi2rx.c b/drivers/media/platform/cadence/cdns-csi2rx.c index 8c19f125da3e..df299f29756f 100644 --- a/drivers/media/platform/cadence/cdns-csi2rx.c +++ b/drivers/media/platform/cadence/cdns-csi2rx.c @@ -824,7 +824,7 @@ static int csi2rx_probe(struct platform_device *pdev) unsigned int i; int ret; - csi2rx = kzalloc(sizeof(*csi2rx), GFP_KERNEL); + csi2rx = kzalloc_obj(*csi2rx, GFP_KERNEL); if (!csi2rx) return -ENOMEM; platform_set_drvdata(pdev, csi2rx); diff --git a/drivers/media/platform/cadence/cdns-csi2tx.c b/drivers/media/platform/cadence/cdns-csi2tx.c index e22b133f346d..80aefdbe259b 100644 --- a/drivers/media/platform/cadence/cdns-csi2tx.c +++ b/drivers/media/platform/cadence/cdns-csi2tx.c @@ -573,7 +573,7 @@ static int csi2tx_probe(struct platform_device *pdev) unsigned int i; int ret; - csi2tx = kzalloc(sizeof(*csi2tx), GFP_KERNEL); + csi2tx = kzalloc_obj(*csi2tx, GFP_KERNEL); if (!csi2tx) return -ENOMEM; platform_set_drvdata(pdev, csi2tx); diff --git a/drivers/media/platform/chips-media/coda/coda-bit.c b/drivers/media/platform/chips-media/coda/coda-bit.c index fa6b72c3bd93..aab26194ad1b 100644 --- a/drivers/media/platform/chips-media/coda/coda-bit.c +++ b/drivers/media/platform/chips-media/coda/coda-bit.c @@ -397,7 +397,7 @@ void coda_fill_bitstream(struct coda_ctx *ctx, struct list_head *buffer_list) */ src_buf = v4l2_m2m_src_buf_remove(ctx->fh.m2m_ctx); - meta = kmalloc(sizeof(*meta), GFP_KERNEL); + meta = kmalloc_obj(*meta, GFP_KERNEL); if (meta) { meta->sequence = src_buf->sequence; meta->timecode = src_buf->timecode; diff --git a/drivers/media/platform/chips-media/coda/coda-common.c b/drivers/media/platform/chips-media/coda/coda-common.c index 33f712ff8556..fea7682b2217 100644 --- a/drivers/media/platform/chips-media/coda/coda-common.c +++ b/drivers/media/platform/chips-media/coda/coda-common.c @@ -2606,7 +2606,7 @@ static int coda_open(struct file *file) int ret; int idx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/coda/coda-jpeg.c b/drivers/media/platform/chips-media/coda/coda-jpeg.c index fb150b87c773..487d08491a42 100644 --- a/drivers/media/platform/chips-media/coda/coda-jpeg.c +++ b/drivers/media/platform/chips-media/coda/coda-jpeg.c @@ -355,7 +355,7 @@ int coda_jpeg_decode_header(struct coda_ctx *ctx, struct vb2_buffer *vb) } huff_tab = ctx->params.jpeg_huff_tab; if (!huff_tab) { - huff_tab = kzalloc(sizeof(struct coda_huff_tab), GFP_KERNEL); + huff_tab = kzalloc_obj(struct coda_huff_tab, GFP_KERNEL); if (!huff_tab) return -ENOMEM; ctx->params.jpeg_huff_tab = huff_tab; @@ -593,7 +593,7 @@ static int coda9_jpeg_gen_enc_huff_tab(struct coda_ctx *ctx, int tab_num, }; int ret = -EINVAL; - huff = kzalloc(sizeof(*huff), GFP_KERNEL); + huff = kzalloc_obj(*huff, GFP_KERNEL); if (!huff) return -ENOMEM; @@ -723,7 +723,7 @@ static int coda9_jpeg_load_huff_tab(struct coda_ctx *ctx) int i, j; int ret; - huff = kzalloc(sizeof(*huff), GFP_KERNEL); + huff = kzalloc_obj(*huff, GFP_KERNEL); if (!huff) return -ENOMEM; diff --git a/drivers/media/platform/chips-media/coda/imx-vdoa.c b/drivers/media/platform/chips-media/coda/imx-vdoa.c index c3561fcecb98..2e85043a7f01 100644 --- a/drivers/media/platform/chips-media/coda/imx-vdoa.c +++ b/drivers/media/platform/chips-media/coda/imx-vdoa.c @@ -201,7 +201,7 @@ struct vdoa_ctx *vdoa_context_create(struct vdoa_data *vdoa) struct vdoa_ctx *ctx; int err; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return NULL; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c index 8917542b993c..097ab7f595b0 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-dec.c @@ -1822,7 +1822,7 @@ static int wave5_vpu_open_dec(struct file *filp) struct v4l2_m2m_ctx *m2m_ctx; int ret = 0; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; @@ -1834,7 +1834,7 @@ static int wave5_vpu_open_dec(struct file *filp) mutex_init(&inst->feed_lock); INIT_LIST_HEAD(&inst->avail_src_bufs); - inst->codec_info = kzalloc(sizeof(*inst->codec_info), GFP_KERNEL); + inst->codec_info = kzalloc_obj(*inst->codec_info, GFP_KERNEL); if (!inst->codec_info) { kfree(inst); return -ENOMEM; diff --git a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c index 24fc0d0d3f4a..f9373ed9a97b 100644 --- a/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c +++ b/drivers/media/platform/chips-media/wave5/wave5-vpu-enc.c @@ -1571,7 +1571,7 @@ static int wave5_vpu_open_enc(struct file *filp) struct v4l2_ctrl_handler *v4l2_ctrl_hdl; int ret = 0; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; v4l2_ctrl_hdl = &inst->v4l2_ctrl_hdl; @@ -1580,7 +1580,7 @@ static int wave5_vpu_open_enc(struct file *filp) inst->type = VPU_INST_TYPE_ENC; inst->ops = &wave5_vpu_enc_inst_ops; - inst->codec_info = kzalloc(sizeof(*inst->codec_info), GFP_KERNEL); + inst->codec_info = kzalloc_obj(*inst->codec_info, GFP_KERNEL); if (!inst->codec_info) { kfree(inst); return -ENOMEM; diff --git a/drivers/media/platform/imagination/e5010-jpeg-enc.c b/drivers/media/platform/imagination/e5010-jpeg-enc.c index 1c6e076033ec..803470d12bdb 100644 --- a/drivers/media/platform/imagination/e5010-jpeg-enc.c +++ b/drivers/media/platform/imagination/e5010-jpeg-enc.c @@ -728,7 +728,7 @@ static int e5010_open(struct file *file) struct e5010_context *ctx; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/intel/pxa_camera.c b/drivers/media/platform/intel/pxa_camera.c index bef1e7137f23..dbd465708f6f 100644 --- a/drivers/media/platform/intel/pxa_camera.c +++ b/drivers/media/platform/intel/pxa_camera.c @@ -741,7 +741,7 @@ static struct pxa_camera_format_xlate *pxa_mbus_build_fmts_xlate( if (!fmts) return ERR_PTR(-ENXIO); - user_formats = kcalloc(fmts + 1, sizeof(*user_formats), GFP_KERNEL); + user_formats = kzalloc_objs(*user_formats, fmts + 1, GFP_KERNEL); if (!user_formats) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/m2m-deinterlace.c b/drivers/media/platform/m2m-deinterlace.c index af098874ead5..568193243869 100644 --- a/drivers/media/platform/m2m-deinterlace.c +++ b/drivers/media/platform/m2m-deinterlace.c @@ -835,7 +835,7 @@ static int deinterlace_open(struct file *file) struct deinterlace_dev *pcdev = video_drvdata(file); struct deinterlace_ctx *ctx = NULL; - ctx = kzalloc(sizeof *ctx, GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/marvell/cafe-driver.c b/drivers/media/platform/marvell/cafe-driver.c index f9796de92aa7..a447099b40cc 100644 --- a/drivers/media/platform/marvell/cafe-driver.c +++ b/drivers/media/platform/marvell/cafe-driver.c @@ -327,7 +327,7 @@ static int cafe_smbus_setup(struct cafe_camera *cam) struct i2c_adapter *adap; int ret; - adap = kzalloc(sizeof(*adap), GFP_KERNEL); + adap = kzalloc_obj(*adap, GFP_KERNEL); if (adap == NULL) return -ENOMEM; adap->owner = THIS_MODULE; @@ -485,7 +485,7 @@ static int cafe_pci_probe(struct pci_dev *pdev, * Start putting together one of our big camera structures. */ ret = -ENOMEM; - cam = kzalloc(sizeof(struct cafe_camera), GFP_KERNEL); + cam = kzalloc_obj(struct cafe_camera, GFP_KERNEL); if (cam == NULL) goto out; pci_set_drvdata(pdev, cam); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c index d08fe365cbb2..7a506b1f03da 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c @@ -1151,7 +1151,7 @@ static int mtk_jpeg_open(struct file *file) struct mtk_jpeg_ctx *ctx; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c index 03c07948dfdd..e069e326d2bd 100644 --- a/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c +++ b/drivers/media/platform/mediatek/mdp/mtk_mdp_m2m.c @@ -1053,7 +1053,7 @@ static int mtk_mdp_m2m_open(struct file *file) int ret; struct v4l2_format default_format; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c index e5ccf673e152..d4dd2cad0d7f 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-cmdq.c @@ -564,7 +564,7 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp, goto err_uninit; } - cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); + cmd = kzalloc_obj(*cmd, GFP_KERNEL); if (!cmd) { ret = -ENOMEM; goto err_uninit; @@ -583,13 +583,13 @@ static struct mdp_cmdq_cmd *mdp_cmdq_prepare(struct mdp_dev *mdp, goto err_destroy_pkt; } - comps = kcalloc(num_comp, sizeof(*comps), GFP_KERNEL); + comps = kzalloc_objs(*comps, num_comp, GFP_KERNEL); if (!comps) { ret = -ENOMEM; goto err_destroy_pkt; } - path = kzalloc(sizeof(*path), GFP_KERNEL); + path = kzalloc_obj(*path, GFP_KERNEL); if (!path) { ret = -ENOMEM; goto err_free_comps; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c index f20d2ed1f2bb..978bf12cc1d0 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-core.c @@ -221,7 +221,7 @@ static int mdp_probe(struct platform_device *pdev) struct resource *res; int ret, i, mutex_id; - mdp = kzalloc(sizeof(*mdp), GFP_KERNEL); + mdp = kzalloc_obj(*mdp, GFP_KERNEL); if (!mdp) { ret = -ENOMEM; goto err_return; diff --git a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c index 44140987cf5f..bb8f70a42f32 100644 --- a/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c +++ b/drivers/media/platform/mediatek/mdp3/mtk-mdp3-m2m.c @@ -568,7 +568,7 @@ static int mdp_m2m_open(struct file *file) struct v4l2_format default_format = {}; const struct mdp_limit *limit = mdp->mdp_data->def_limit; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c index 643d6fff088b..c4566eb52db8 100644 --- a/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c +++ b/drivers/media/platform/mediatek/vcodec/common/mtk_vcodec_dbgfs.c @@ -149,7 +149,7 @@ void mtk_vcodec_dbgfs_create(struct mtk_vcodec_dec_ctx *ctx) struct mtk_vcodec_dbgfs_inst *dbgfs_inst; struct mtk_vcodec_dec_dev *vcodec_dev = ctx->dev; - dbgfs_inst = kzalloc(sizeof(*dbgfs_inst), GFP_KERNEL); + dbgfs_inst = kzalloc_obj(*dbgfs_inst, GFP_KERNEL); if (!dbgfs_inst) return; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c index 3b81fae9f913..066bb304a34c 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_drv.c @@ -200,7 +200,7 @@ static int fops_vcodec_open(struct file *file) struct vb2_queue *src_vq; unsigned long flags; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c index 8e1cf16a168a..85b88aa45f5b 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/mtk_vcodec_dec_stateless.c @@ -735,7 +735,7 @@ static struct media_request *fops_media_request_alloc(struct media_device *mdev) { struct mtk_vcodec_dec_request *req; - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); return &req->req; } diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c index 7be4b6086920..a3ea4d2a9fb0 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_av1_req_lat_if.c @@ -1879,7 +1879,7 @@ static int vdec_av1_slice_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_av1_slice_init_vsi *vsi; int ret; - instance = kzalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc_obj(*instance, GFP_KERNEL); if (!instance) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c index 795cb19b075d..a754b96ae84b 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_if.c @@ -270,7 +270,7 @@ static int vdec_h264_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_h264_inst *inst = NULL; int err; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c index b9a5ea7887d3..9cf7ff35731e 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_if.c @@ -273,7 +273,7 @@ static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_h264_slice_inst *inst; int err; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c index 9a9dc2f88d6e..d761e70f5933 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_h264_req_multi_if.c @@ -1208,7 +1208,7 @@ static int vdec_h264_slice_init(struct mtk_vcodec_dec_ctx *ctx) int err, vsi_size; unsigned char *temp; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c index 88eca50c2017..1c925deaa721 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_hevc_req_multi_if.c @@ -858,7 +858,7 @@ static int vdec_hevc_slice_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_hevc_slice_inst *inst; int err, vsi_size; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c index 5f848691cea4..af5bd3c24729 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_if.c @@ -390,7 +390,7 @@ static int vdec_vp8_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_vp8_inst *inst; int err; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c index e1d4960553f2..27d6af7836b9 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp8_req_if.c @@ -275,7 +275,7 @@ static int vdec_vp8_slice_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_vp8_slice_inst *inst; int err; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c index cd1935014d76..1b4bc0f60b8b 100644 --- a/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c +++ b/drivers/media/platform/mediatek/vcodec/decoder/vdec/vdec_vp9_req_lat_if.c @@ -1848,7 +1848,7 @@ static int vdec_vp9_slice_init(struct mtk_vcodec_dec_ctx *ctx) struct vdec_vp9_slice_init_vsi *vsi; int ret; - instance = kzalloc(sizeof(*instance), GFP_KERNEL); + instance = kzalloc_obj(*instance, GFP_KERNEL); if (!instance) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c index 82b8ff38e8f1..c02cdb7acd63 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/mtk_vcodec_enc_drv.c @@ -119,7 +119,7 @@ static int fops_vcodec_open(struct file *file) struct vb2_queue *src_vq; unsigned long flags; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c index 0f63657d8bad..d7630d9ae305 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_h264_if.c @@ -588,7 +588,7 @@ static int h264_enc_init(struct mtk_vcodec_enc_ctx *ctx) int ret = 0; struct venc_h264_inst *inst; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c index 05abca91e742..b85b177ebcce 100644 --- a/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c +++ b/drivers/media/platform/mediatek/vcodec/encoder/venc/venc_vp8_if.c @@ -316,7 +316,7 @@ static int vp8_enc_init(struct mtk_vcodec_enc_ctx *ctx) int ret = 0; struct venc_vp8_inst *inst; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/nuvoton/npcm-video.c b/drivers/media/platform/nuvoton/npcm-video.c index 44e904e61801..eccd92774344 100644 --- a/drivers/media/platform/nuvoton/npcm-video.c +++ b/drivers/media/platform/nuvoton/npcm-video.c @@ -411,7 +411,7 @@ static unsigned int npcm_video_add_rect(struct npcm_video *video, struct rect_list *list = NULL; struct v4l2_rect *r; - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = kzalloc_obj(*list, GFP_KERNEL); if (!list) return 0; @@ -466,7 +466,7 @@ static struct rect_list *npcm_video_new_rect(struct npcm_video *video, struct rect_list *list = NULL; struct v4l2_rect *r; - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = kzalloc_obj(*list, GFP_KERNEL); if (!list) return NULL; @@ -1733,7 +1733,7 @@ static int npcm_video_init(struct npcm_video *video) static int npcm_video_probe(struct platform_device *pdev) { - struct npcm_video *video = kzalloc(sizeof(*video), GFP_KERNEL); + struct npcm_video *video = kzalloc_obj(*video, GFP_KERNEL); int rc; void __iomem *regs; diff --git a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c index b34244ea14dd..4e4b8c09d5be 100644 --- a/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c +++ b/drivers/media/platform/nvidia/tegra-vde/dmabuf-cache.c @@ -115,7 +115,7 @@ int tegra_vde_dmabuf_cache_map(struct tegra_vde *vde, goto err_unmap; } - entry = kzalloc(sizeof(*entry), GFP_KERNEL); + entry = kzalloc_obj(*entry, GFP_KERNEL); if (!entry) { err = -ENOMEM; goto err_unmap; diff --git a/drivers/media/platform/nvidia/tegra-vde/v4l2.c b/drivers/media/platform/nvidia/tegra-vde/v4l2.c index d94978ae2baf..d877802352d3 100644 --- a/drivers/media/platform/nvidia/tegra-vde/v4l2.c +++ b/drivers/media/platform/nvidia/tegra-vde/v4l2.c @@ -811,8 +811,7 @@ static int tegra_open(struct file *file) struct tegra_ctx *ctx; int err; - ctx = kzalloc(struct_size(ctx, ctrls, ARRAY_SIZE(ctrl_cfgs)), - GFP_KERNEL); + ctx = kzalloc_flex(*ctx, ctrls, ARRAY_SIZE(ctrl_cfgs), GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/nvidia/tegra-vde/vde.c b/drivers/media/platform/nvidia/tegra-vde/vde.c index 3232392c60e2..a1d4a1ab12f9 100644 --- a/drivers/media/platform/nvidia/tegra-vde/vde.c +++ b/drivers/media/platform/nvidia/tegra-vde/vde.c @@ -61,7 +61,7 @@ int tegra_vde_alloc_bo(struct tegra_vde *vde, struct tegra_vde_bo *bo; int err; - bo = kzalloc(sizeof(*bo), GFP_KERNEL); + bo = kzalloc_obj(*bo, GFP_KERNEL); if (!bo) return -ENOMEM; diff --git a/drivers/media/platform/nxp/dw100/dw100.c b/drivers/media/platform/nxp/dw100/dw100.c index 4aaf9c3fff53..cf20f1ffc1d1 100644 --- a/drivers/media/platform/nxp/dw100/dw100.c +++ b/drivers/media/platform/nxp/dw100/dw100.c @@ -601,7 +601,7 @@ static int dw100_open(struct file *file) struct v4l2_pix_format_mplane *pix_fmt; int ret, i; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c index b558700d1d96..100320ddf545 100644 --- a/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c +++ b/drivers/media/platform/nxp/imx-jpeg/mxc-jpeg.c @@ -2200,7 +2200,7 @@ static int mxc_jpeg_open(struct file *file) struct mxc_jpeg_ctx *ctx; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c index 3f9a67a6bd4d..ad31a3459b94 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -1646,7 +1646,7 @@ static int pxp_open(struct file *file) if (mutex_lock_interruptible(&dev->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { rc = -ENOMEM; goto open_unlock; diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c index 18146978bdf5..87346979ef09 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-core.c @@ -474,8 +474,8 @@ static int mxc_isi_probe(struct platform_device *pdev) isi->pdata = of_device_get_match_data(dev); - isi->pipes = kcalloc(isi->pdata->num_channels, sizeof(isi->pipes[0]), - GFP_KERNEL); + isi->pipes = kzalloc_objs(isi->pipes[0], isi->pdata->num_channels, + GFP_KERNEL); if (!isi->pipes) return -ENOMEM; diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c index 3c26cfef93d1..2cd014a79006 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-crossbar.c @@ -189,7 +189,7 @@ static int mxc_isi_crossbar_init_state(struct v4l2_subdev *sd, * pipelines by default. */ routing.num_routes = min(xbar->num_sinks - 1, xbar->num_sources); - routes = kcalloc(routing.num_routes, sizeof(*routes), GFP_KERNEL); + routes = kzalloc_objs(*routes, routing.num_routes, GFP_KERNEL); if (!routes) return -ENOMEM; @@ -454,12 +454,11 @@ int mxc_isi_crossbar_init(struct mxc_isi_dev *isi) xbar->num_sources = isi->pdata->num_channels; num_pads = xbar->num_sinks + xbar->num_sources; - xbar->pads = kcalloc(num_pads, sizeof(*xbar->pads), GFP_KERNEL); + xbar->pads = kzalloc_objs(*xbar->pads, num_pads, GFP_KERNEL); if (!xbar->pads) return -ENOMEM; - xbar->inputs = kcalloc(xbar->num_sinks, sizeof(*xbar->inputs), - GFP_KERNEL); + xbar->inputs = kzalloc_objs(*xbar->inputs, xbar->num_sinks, GFP_KERNEL); if (!xbar->inputs) { ret = -ENOMEM; goto err_free; diff --git a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c index f425ac786854..e6ad1044b954 100644 --- a/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c +++ b/drivers/media/platform/nxp/imx8-isi/imx8-isi-m2m.c @@ -624,7 +624,7 @@ static int mxc_isi_m2m_open(struct file *file) struct mxc_isi_m2m_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/nxp/mx2_emmaprp.c b/drivers/media/platform/nxp/mx2_emmaprp.c index 02d57229b9b3..8f588688f049 100644 --- a/drivers/media/platform/nxp/mx2_emmaprp.c +++ b/drivers/media/platform/nxp/mx2_emmaprp.c @@ -718,7 +718,7 @@ static int emmaprp_open(struct file *file) struct emmaprp_dev *pcdev = video_drvdata(file); struct emmaprp_ctx *ctx; - ctx = kzalloc(sizeof *ctx, GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/qcom/iris/iris_buffer.c b/drivers/media/platform/qcom/iris/iris_buffer.c index f1f003a787bf..f0fdba0ae987 100644 --- a/drivers/media/platform/qcom/iris/iris_buffer.c +++ b/drivers/media/platform/qcom/iris/iris_buffer.c @@ -342,7 +342,7 @@ static int iris_create_internal_buffer(struct iris_inst *inst, if (!buffers->size) return 0; - buffer = kzalloc(sizeof(*buffer), GFP_KERNEL); + buffer = kzalloc_obj(*buffer, GFP_KERNEL); if (!buffer) return -ENOMEM; diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c index 11815f6f5bac..abffd20cf25b 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen1_command.c @@ -1087,5 +1087,5 @@ void iris_hfi_gen1_command_ops_init(struct iris_core *core) struct iris_inst *iris_hfi_gen1_get_instance(void) { - return kzalloc(sizeof(struct iris_inst), GFP_KERNEL); + return kzalloc_obj(struct iris_inst, GFP_KERNEL); } diff --git a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c index 715ec9575b90..d45cecd5e544 100644 --- a/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c +++ b/drivers/media/platform/qcom/iris/iris_hfi_gen2_command.c @@ -1329,7 +1329,7 @@ struct iris_inst *iris_hfi_gen2_get_instance(void) struct iris_inst_hfi_gen2 *out; /* The allocation is intentionally larger than struct iris_inst. */ - out = kzalloc(sizeof(*out), GFP_KERNEL); + out = kzalloc_obj(*out, GFP_KERNEL); return &out->inst; } diff --git a/drivers/media/platform/qcom/iris/iris_vdec.c b/drivers/media/platform/qcom/iris/iris_vdec.c index 467d00044a2f..3cfbdc04d3a9 100644 --- a/drivers/media/platform/qcom/iris/iris_vdec.c +++ b/drivers/media/platform/qcom/iris/iris_vdec.c @@ -21,8 +21,8 @@ int iris_vdec_inst_init(struct iris_inst *inst) struct iris_core *core = inst->core; struct v4l2_format *f; - inst->fmt_src = kzalloc(sizeof(*inst->fmt_src), GFP_KERNEL); - inst->fmt_dst = kzalloc(sizeof(*inst->fmt_dst), GFP_KERNEL); + inst->fmt_src = kzalloc_obj(*inst->fmt_src, GFP_KERNEL); + inst->fmt_dst = kzalloc_obj(*inst->fmt_dst, GFP_KERNEL); inst->fw_min_count = MIN_BUFFERS; diff --git a/drivers/media/platform/qcom/iris/iris_venc.c b/drivers/media/platform/qcom/iris/iris_venc.c index 6461d9c9d598..d3531a3cc2a2 100644 --- a/drivers/media/platform/qcom/iris/iris_venc.c +++ b/drivers/media/platform/qcom/iris/iris_venc.c @@ -19,8 +19,8 @@ int iris_venc_inst_init(struct iris_inst *inst) struct iris_core *core = inst->core; struct v4l2_format *f; - inst->fmt_src = kzalloc(sizeof(*inst->fmt_src), GFP_KERNEL); - inst->fmt_dst = kzalloc(sizeof(*inst->fmt_dst), GFP_KERNEL); + inst->fmt_src = kzalloc_obj(*inst->fmt_src, GFP_KERNEL); + inst->fmt_dst = kzalloc_obj(*inst->fmt_dst, GFP_KERNEL); if (!inst->fmt_src || !inst->fmt_dst) { kfree(inst->fmt_src); kfree(inst->fmt_dst); diff --git a/drivers/media/platform/qcom/venus/core.c b/drivers/media/platform/qcom/venus/core.c index 24d2b2fd0340..db3536956131 100644 --- a/drivers/media/platform/qcom/venus/core.c +++ b/drivers/media/platform/qcom/venus/core.c @@ -213,7 +213,7 @@ static int venus_enumerate_codecs(struct venus_core *core, u32 type) if (core->res->hfi_version != HFI_VERSION_1XX) return 0; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; @@ -329,7 +329,7 @@ static int venus_add_dynamic_nodes(struct venus_core *core) struct device *dev = core->dev; int ret; - core->ocs = kmalloc(sizeof(*core->ocs), GFP_KERNEL); + core->ocs = kmalloc_obj(*core->ocs, GFP_KERNEL); if (!core->ocs) return -ENOMEM; diff --git a/drivers/media/platform/qcom/venus/helpers.c b/drivers/media/platform/qcom/venus/helpers.c index 2e4363f82231..f4223470f0dd 100644 --- a/drivers/media/platform/qcom/venus/helpers.c +++ b/drivers/media/platform/qcom/venus/helpers.c @@ -192,7 +192,7 @@ int venus_helper_alloc_dpb_bufs(struct venus_inst *inst) count = hfi_bufreq_get_count_min(&bufreq, ver); for (i = 0; i < count; i++) { - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) { ret = -ENOMEM; goto fail; @@ -248,7 +248,7 @@ static int intbufs_set_buffer(struct venus_inst *inst, u32 type) return 0; for (i = 0; i < bufreq.count_actual; i++) { - buf = kzalloc(sizeof(*buf), GFP_KERNEL); + buf = kzalloc_obj(*buf, GFP_KERNEL); if (!buf) { ret = -ENOMEM; goto fail; diff --git a/drivers/media/platform/qcom/venus/hfi_venus.c b/drivers/media/platform/qcom/venus/hfi_venus.c index d3da35f67fd5..a6cf17e379f7 100644 --- a/drivers/media/platform/qcom/venus/hfi_venus.c +++ b/drivers/media/platform/qcom/venus/hfi_venus.c @@ -1702,7 +1702,7 @@ int venus_hfi_create(struct venus_core *core) struct venus_hfi_device *hdev; int ret; - hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); + hdev = kzalloc_obj(*hdev, GFP_KERNEL); if (!hdev) return -ENOMEM; diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c index 21ca4947a849..3f46e2d8ccce 100644 --- a/drivers/media/platform/qcom/venus/vdec.c +++ b/drivers/media/platform/qcom/venus/vdec.c @@ -1684,7 +1684,7 @@ static int vdec_open(struct file *file) struct venus_inst *inst; int ret; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/qcom/venus/venc.c b/drivers/media/platform/qcom/venus/venc.c index 0b5843ba536f..32185f29eee5 100644 --- a/drivers/media/platform/qcom/venus/venc.c +++ b/drivers/media/platform/qcom/venus/venc.c @@ -1466,7 +1466,7 @@ static int venc_open(struct file *file) struct venus_inst *inst; int ret; - inst = kzalloc(sizeof(*inst), GFP_KERNEL); + inst = kzalloc_obj(*inst, GFP_KERNEL); if (!inst) return -ENOMEM; diff --git a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c index 62dca76b468d..a02a966d9c3b 100644 --- a/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c +++ b/drivers/media/platform/raspberrypi/rp1-cfe/cfe.c @@ -2279,7 +2279,7 @@ static int cfe_probe(struct platform_device *pdev) char debugfs_name[32]; int ret; - cfe = kzalloc(sizeof(*cfe), GFP_KERNEL); + cfe = kzalloc_obj(*cfe, GFP_KERNEL); if (!cfe) return -ENOMEM; diff --git a/drivers/media/platform/renesas/rcar-vin/rcar-core.c b/drivers/media/platform/renesas/rcar-vin/rcar-core.c index 100105b620e3..36421defa598 100644 --- a/drivers/media/platform/renesas/rcar-vin/rcar-core.c +++ b/drivers/media/platform/renesas/rcar-vin/rcar-core.c @@ -128,7 +128,7 @@ static int rvin_group_get(struct rvin_dev *vin, group = rvin_group_data; kref_get(&group->refcount); } else { - group = kzalloc(sizeof(*group), GFP_KERNEL); + group = kzalloc_obj(*group, GFP_KERNEL); if (!group) { ret = -ENOMEM; goto err_group; diff --git a/drivers/media/platform/renesas/rcar_fdp1.c b/drivers/media/platform/renesas/rcar_fdp1.c index 672869815f63..791cff4a48ea 100644 --- a/drivers/media/platform/renesas/rcar_fdp1.c +++ b/drivers/media/platform/renesas/rcar_fdp1.c @@ -2078,7 +2078,7 @@ static int fdp1_open(struct file *file) if (mutex_lock_interruptible(&fdp1->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto done; diff --git a/drivers/media/platform/renesas/rcar_jpu.c b/drivers/media/platform/renesas/rcar_jpu.c index a6d26b446494..3a3aa6bba9d2 100644 --- a/drivers/media/platform/renesas/rcar_jpu.c +++ b/drivers/media/platform/renesas/rcar_jpu.c @@ -1212,7 +1212,7 @@ static int jpu_open(struct file *file) struct jpu_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/renesas/renesas-ceu.c b/drivers/media/platform/renesas/renesas-ceu.c index deed49d0fb10..a827a4cf6826 100644 --- a/drivers/media/platform/renesas/renesas-ceu.c +++ b/drivers/media/platform/renesas/renesas-ceu.c @@ -1616,7 +1616,7 @@ static int ceu_probe(struct platform_device *pdev) int num_subdevs; int ret; - ceudev = kzalloc(sizeof(*ceudev), GFP_KERNEL); + ceudev = kzalloc_obj(*ceudev, GFP_KERNEL); if (!ceudev) return -ENOMEM; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_dl.c b/drivers/media/platform/renesas/vsp1/vsp1_dl.c index d732b4ed1180..f6b5623bf7d5 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_dl.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_dl.c @@ -259,7 +259,7 @@ vsp1_dl_body_pool_create(struct vsp1_device *vsp1, unsigned int num_bodies, size_t dlb_size; unsigned int i; - pool = kzalloc(sizeof(*pool), GFP_KERNEL); + pool = kzalloc_obj(*pool, GFP_KERNEL); if (!pool) return NULL; @@ -274,7 +274,7 @@ vsp1_dl_body_pool_create(struct vsp1_device *vsp1, unsigned int num_bodies, dlb_size = num_entries * sizeof(struct vsp1_dl_entry) + extra_size; pool->size = dlb_size * num_bodies; - pool->bodies = kcalloc(num_bodies, sizeof(*pool->bodies), GFP_KERNEL); + pool->bodies = kzalloc_objs(*pool->bodies, num_bodies, GFP_KERNEL); if (!pool->bodies) { kfree(pool); return NULL; @@ -434,7 +434,7 @@ vsp1_dl_cmd_pool_create(struct vsp1_device *vsp1, enum vsp1_extcmd_type type, unsigned int i; size_t cmd_size; - pool = kzalloc(sizeof(*pool), GFP_KERNEL); + pool = kzalloc_obj(*pool, GFP_KERNEL); if (!pool) return NULL; @@ -443,7 +443,7 @@ vsp1_dl_cmd_pool_create(struct vsp1_device *vsp1, enum vsp1_extcmd_type type, spin_lock_init(&pool->lock); INIT_LIST_HEAD(&pool->free); - pool->cmds = kcalloc(num_cmds, sizeof(*pool->cmds), GFP_KERNEL); + pool->cmds = kzalloc_objs(*pool->cmds, num_cmds, GFP_KERNEL); if (!pool->cmds) { kfree(pool); return NULL; @@ -557,7 +557,7 @@ static struct vsp1_dl_list *vsp1_dl_list_alloc(struct vsp1_dl_manager *dlm) struct vsp1_dl_list *dl; size_t header_offset; - dl = kzalloc(sizeof(*dl), GFP_KERNEL); + dl = kzalloc_obj(*dl, GFP_KERNEL); if (!dl) return NULL; diff --git a/drivers/media/platform/renesas/vsp1/vsp1_video.c b/drivers/media/platform/renesas/vsp1/vsp1_video.c index 75f9a1a85d55..e1f1c2a933ab 100644 --- a/drivers/media/platform/renesas/vsp1/vsp1_video.c +++ b/drivers/media/platform/renesas/vsp1/vsp1_video.c @@ -565,7 +565,7 @@ static struct vsp1_pipeline *vsp1_video_pipeline_get(struct vsp1_video *video) * when the last reference is released. */ if (!video->rwpf->entity.pipe) { - pipe = kzalloc(sizeof(*pipe), GFP_KERNEL); + pipe = kzalloc_obj(*pipe, GFP_KERNEL); if (!pipe) return ERR_PTR(-ENOMEM); @@ -720,8 +720,8 @@ static int vsp1_video_pipeline_setup_partitions(struct vsp1_pipeline *pipe) } pipe->partitions = DIV_ROUND_UP(format->width, div_size); - pipe->part_table = kcalloc(pipe->partitions, sizeof(*pipe->part_table), - GFP_KERNEL); + pipe->part_table = kzalloc_objs(*pipe->part_table, pipe->partitions, + GFP_KERNEL); if (!pipe->part_table) return -ENOMEM; @@ -1074,7 +1074,7 @@ static int vsp1_video_open(struct file *file) struct v4l2_fh *vfh; int ret = 0; - vfh = kzalloc(sizeof(*vfh), GFP_KERNEL); + vfh = kzalloc_obj(*vfh, GFP_KERNEL); if (vfh == NULL) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rga/rga.c b/drivers/media/platform/rockchip/rga/rga.c index 43f6a8d99381..736072635ed5 100644 --- a/drivers/media/platform/rockchip/rga/rga.c +++ b/drivers/media/platform/rockchip/rga/rga.c @@ -370,7 +370,7 @@ static int rga_open(struct file *file) struct rga_ctx *ctx = NULL; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->rga = rga; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-h264.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-h264.c index a1af12c97914..377607c94092 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-h264.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-h264.c @@ -375,7 +375,7 @@ static int rkvdec_h264_start(struct rkvdec_ctx *ctx) if (ret) return ret; - h264_ctx = kzalloc(sizeof(*h264_ctx), GFP_KERNEL); + h264_ctx = kzalloc_obj(*h264_ctx, GFP_KERNEL); if (!h264_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c index 3276f584f5c7..abb695ebe258 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-hevc.c @@ -528,7 +528,7 @@ static int rkvdec_hevc_start(struct rkvdec_ctx *ctx) struct rkvdec_hevc_priv_tbl *priv_tbl; struct rkvdec_hevc_ctx *hevc_ctx; - hevc_ctx = kzalloc(sizeof(*hevc_ctx), GFP_KERNEL); + hevc_ctx = kzalloc_obj(*hevc_ctx, GFP_KERNEL); if (!hevc_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-h264.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-h264.c index cd0aa3f3a13d..218377f91a0b 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-h264.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-h264.c @@ -383,7 +383,7 @@ static int rkvdec_h264_start(struct rkvdec_ctx *ctx) if (ret) return ret; - h264_ctx = kzalloc(sizeof(*h264_ctx), GFP_KERNEL); + h264_ctx = kzalloc_obj(*h264_ctx, GFP_KERNEL); if (!h264_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c index 5f1c11ffb9f0..b5f20c8d4285 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu381-hevc.c @@ -551,7 +551,7 @@ static int rkvdec_hevc_start(struct rkvdec_ctx *ctx) if (ret) return ret; - hevc_ctx = kzalloc(sizeof(*hevc_ctx), GFP_KERNEL); + hevc_ctx = kzalloc_obj(*hevc_ctx, GFP_KERNEL); if (!hevc_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-h264.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-h264.c index 6ab3167addc8..bb53163efe41 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-h264.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-h264.c @@ -447,7 +447,7 @@ static int rkvdec_h264_start(struct rkvdec_ctx *ctx) if (ret) return ret; - h264_ctx = kzalloc(sizeof(*h264_ctx), GFP_KERNEL); + h264_ctx = kzalloc_obj(*h264_ctx, GFP_KERNEL); if (!h264_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c index 085c0a63a80c..0e5a58e48608 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vdpu383-hevc.c @@ -559,7 +559,7 @@ static int rkvdec_hevc_start(struct rkvdec_ctx *ctx) if (ret) return ret; - hevc_ctx = kzalloc(sizeof(*hevc_ctx), GFP_KERNEL); + hevc_ctx = kzalloc_obj(*hevc_ctx, GFP_KERNEL); if (!hevc_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c b/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c index ba51a7c2fe55..1e66333e4589 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec-vp9.c @@ -971,7 +971,7 @@ static int rkvdec_vp9_start(struct rkvdec_ctx *ctx) unsigned char *count_tbl; int ret; - vp9_ctx = kzalloc(sizeof(*vp9_ctx), GFP_KERNEL); + vp9_ctx = kzalloc_obj(*vp9_ctx, GFP_KERNEL); if (!vp9_ctx) return -ENOMEM; diff --git a/drivers/media/platform/rockchip/rkvdec/rkvdec.c b/drivers/media/platform/rockchip/rkvdec/rkvdec.c index 967c452ab61f..2d4493434077 100644 --- a/drivers/media/platform/rockchip/rkvdec/rkvdec.c +++ b/drivers/media/platform/rockchip/rkvdec/rkvdec.c @@ -1282,7 +1282,7 @@ static int rkvdec_open(struct file *filp) struct rkvdec_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c index 722e2531e23f..9d15a2115c23 100644 --- a/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c +++ b/drivers/media/platform/samsung/exynos-gsc/gsc-m2m.c @@ -612,7 +612,7 @@ static int gsc_m2m_open(struct file *file) if (mutex_lock_interruptible(&gsc->lock)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto unlock; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c index 5b412afd7d60..0b8327e4a875 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c @@ -1718,7 +1718,7 @@ static int fimc_register_capture_device(struct fimc_dev *fimc, struct fimc_ctx *ctx; int ret = -ENOMEM; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c index 562c57f186c6..2aa9c22df72b 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-m2m.c @@ -616,7 +616,7 @@ static int fimc_m2m_open(struct file *file) if (test_bit(ST_CAPT_BUSY, &fimc->state)) goto unlock; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto unlock; diff --git a/drivers/media/platform/samsung/exynos4-is/media-dev.c b/drivers/media/platform/samsung/exynos4-is/media-dev.c index bc7087eb761a..56d8b7cd3b5a 100644 --- a/drivers/media/platform/samsung/exynos4-is/media-dev.c +++ b/drivers/media/platform/samsung/exynos4-is/media-dev.c @@ -373,7 +373,7 @@ static struct exynos_media_pipeline *fimc_md_pipeline_create( { struct fimc_pipeline *p; - p = kzalloc(sizeof(*p), GFP_KERNEL); + p = kzalloc_obj(*p, GFP_KERNEL); if (!p) return NULL; diff --git a/drivers/media/platform/samsung/s5p-g2d/g2d.c b/drivers/media/platform/samsung/s5p-g2d/g2d.c index e765dfcc2830..a1d6315d8c4a 100644 --- a/drivers/media/platform/samsung/s5p-g2d/g2d.c +++ b/drivers/media/platform/samsung/s5p-g2d/g2d.c @@ -237,7 +237,7 @@ static int g2d_open(struct file *file) struct g2d_ctx *ctx = NULL; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->dev = dev; diff --git a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c index ff28482759ec..68250d7bb02d 100644 --- a/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c +++ b/drivers/media/platform/samsung/s5p-jpeg/jpeg-core.c @@ -953,7 +953,7 @@ static int s5p_jpeg_open(struct file *file) struct s5p_jpeg_fmt *out_fmt, *cap_fmt; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c index 4948d734eb02..e79441f01a51 100644 --- a/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c +++ b/drivers/media/platform/samsung/s5p-mfc/s5p_mfc.c @@ -794,7 +794,7 @@ static int s5p_mfc_open(struct file *file) } dev->num_inst++; /* It is guarded by mfc_mutex in vfd */ /* Allocate memory for context */ - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto err_alloc; diff --git a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c index 56169b70652d..6f7b3f0db48e 100644 --- a/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c +++ b/drivers/media/platform/st/sti/bdisp/bdisp-v4l2.c @@ -583,7 +583,7 @@ static int bdisp_open(struct file *file) return -ERESTARTSYS; /* Allocate memory for both context and node */ - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto unlock; diff --git a/drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c b/drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c index a078f1107300..ed05feac6944 100644 --- a/drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c +++ b/drivers/media/platform/st/sti/delta/delta-mjpeg-dec.c @@ -324,7 +324,7 @@ static int delta_mjpeg_open(struct delta_ctx *pctx) { struct delta_mjpeg_ctx *ctx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; pctx->priv = ctx; diff --git a/drivers/media/platform/st/sti/delta/delta-v4l2.c b/drivers/media/platform/st/sti/delta/delta-v4l2.c index 6c1a53c771f7..b3fb25bd0f60 100644 --- a/drivers/media/platform/st/sti/delta/delta-v4l2.c +++ b/drivers/media/platform/st/sti/delta/delta-v4l2.c @@ -164,7 +164,7 @@ static void delta_push_dts(struct delta_ctx *ctx, u64 val) { struct delta_dts *dts; - dts = kzalloc(sizeof(*dts), GFP_KERNEL); + dts = kzalloc_obj(*dts, GFP_KERNEL); if (!dts) return; @@ -1629,7 +1629,7 @@ static int delta_open(struct file *file) mutex_lock(&delta->lock); - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto err; diff --git a/drivers/media/platform/st/sti/hva/hva-v4l2.c b/drivers/media/platform/st/sti/hva/hva-v4l2.c index 3581b73a99b8..4b2100b7242b 100644 --- a/drivers/media/platform/st/sti/hva/hva-v4l2.c +++ b/drivers/media/platform/st/sti/hva/hva-v4l2.c @@ -1165,7 +1165,7 @@ static int hva_open(struct file *file) struct hva_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { ret = -ENOMEM; goto out; diff --git a/drivers/media/platform/st/stm32/dma2d/dma2d.c b/drivers/media/platform/st/stm32/dma2d/dma2d.c index 72488aa922fc..fb11794c6b17 100644 --- a/drivers/media/platform/st/stm32/dma2d/dma2d.c +++ b/drivers/media/platform/st/stm32/dma2d/dma2d.c @@ -280,7 +280,7 @@ static int dma2d_open(struct file *file) struct dma2d_ctx *ctx = NULL; int ret = 0; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; ctx->dev = dev; diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c index 19e6b187be22..ccf3c19883c0 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-bytecap.c @@ -867,7 +867,7 @@ struct dcmipp_ent_device *dcmipp_bytecap_ent_init(struct device *dev, int ret = 0; /* Allocate the dcmipp_bytecap_device struct */ - vcap = kzalloc(sizeof(*vcap), GFP_KERNEL); + vcap = kzalloc_obj(*vcap, GFP_KERNEL); if (!vcap) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c index f9e4a3a9ef3f..4704cc4d6111 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-byteproc.c @@ -581,7 +581,7 @@ dcmipp_byteproc_ent_init(struct device *dev, const char *entity_name, int ret; /* Allocate the byteproc struct */ - byteproc = kzalloc(sizeof(*byteproc), GFP_KERNEL); + byteproc = kzalloc_obj(*byteproc, GFP_KERNEL); if (!byteproc) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c index 562933e08d62..f6e83e72c940 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-common.c @@ -20,7 +20,7 @@ struct media_pad *dcmipp_pads_init(u16 num_pads, const unsigned long *pads_flags unsigned int i; /* Allocate memory for the pads */ - pads = kcalloc(num_pads, sizeof(*pads), GFP_KERNEL); + pads = kzalloc_objs(*pads, num_pads, GFP_KERNEL); if (!pads) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c index c4bc76909b1c..ac19ed966521 100644 --- a/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c +++ b/drivers/media/platform/st/stm32/stm32-dcmipp/dcmipp-input.c @@ -527,7 +527,7 @@ struct dcmipp_ent_device *dcmipp_inp_ent_init(struct device *dev, int ret; /* Allocate the inp struct */ - inp = kzalloc(sizeof(*inp), GFP_KERNEL); + inp = kzalloc_obj(*inp, GFP_KERNEL); if (!inp) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c index 7c4dd1ac772d..a2e4dae765ee 100644 --- a/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c +++ b/drivers/media/platform/sunxi/sun8i-di/sun8i-di.c @@ -709,7 +709,7 @@ static int deinterlace_open(struct file *file) if (mutex_lock_interruptible(&dev->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { mutex_unlock(&dev->dev_mutex); return -ENOMEM; diff --git a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c index 2deab920884a..05b51e5fc01f 100644 --- a/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c +++ b/drivers/media/platform/sunxi/sun8i-rotate/sun8i_rotate.c @@ -642,7 +642,7 @@ static int rotate_open(struct file *file) if (mutex_lock_interruptible(&dev->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { mutex_unlock(&dev->dev_mutex); return -ENOMEM; diff --git a/drivers/media/platform/ti/cal/cal.c b/drivers/media/platform/ti/cal/cal.c index 3e25ce0c3c3b..c0883b948cbc 100644 --- a/drivers/media/platform/ti/cal/cal.c +++ b/drivers/media/platform/ti/cal/cal.c @@ -1012,7 +1012,7 @@ static struct cal_ctx *cal_ctx_create(struct cal_dev *cal, int inst) struct cal_ctx *ctx; int ret; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return NULL; diff --git a/drivers/media/platform/ti/davinci/vpif.c b/drivers/media/platform/ti/davinci/vpif.c index 969d623fc842..f0d724efb494 100644 --- a/drivers/media/platform/ti/davinci/vpif.c +++ b/drivers/media/platform/ti/davinci/vpif.c @@ -450,7 +450,7 @@ static int vpif_probe(struct platform_device *pdev) if (IS_ERR(vpif_base)) return PTR_ERR(vpif_base); - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) return -ENOMEM; @@ -482,7 +482,7 @@ static int vpif_probe(struct platform_device *pdev) res_irq = DEFINE_RES_IRQ_NAMED(irq, of_node_full_name(pdev->dev.of_node)); res_irq.flags |= irq_get_trigger_type(irq); - pdev_capture = kzalloc(sizeof(*pdev_capture), GFP_KERNEL); + pdev_capture = kzalloc_obj(*pdev_capture, GFP_KERNEL); if (!pdev_capture) { ret = -ENOMEM; goto err_put_rpm; @@ -501,7 +501,7 @@ static int vpif_probe(struct platform_device *pdev) if (ret) goto err_put_pdev_capture; - pdev_display = kzalloc(sizeof(*pdev_display), GFP_KERNEL); + pdev_display = kzalloc_obj(*pdev_display, GFP_KERNEL); if (!pdev_display) { ret = -ENOMEM; goto err_del_pdev_capture; diff --git a/drivers/media/platform/ti/davinci/vpif_capture.c b/drivers/media/platform/ti/davinci/vpif_capture.c index 243c6196b024..6b7d19a7529a 100644 --- a/drivers/media/platform/ti/davinci/vpif_capture.c +++ b/drivers/media/platform/ti/davinci/vpif_capture.c @@ -1335,8 +1335,7 @@ static int initialize_vpif(void) /* Allocate memory for six channel objects */ for (i = 0; i < VPIF_CAPTURE_MAX_DEVICES; i++) { - vpif_obj.dev[i] = - kzalloc(sizeof(*vpif_obj.dev[i]), GFP_KERNEL); + vpif_obj.dev[i] = kzalloc_obj(*vpif_obj.dev[i], GFP_KERNEL); /* If memory allocation fails, return error */ if (!vpif_obj.dev[i]) { free_channel_objects_index = i; @@ -1651,7 +1650,7 @@ static int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; - vpif_obj.sd = kcalloc(subdev_count, sizeof(*vpif_obj.sd), GFP_KERNEL); + vpif_obj.sd = kzalloc_objs(*vpif_obj.sd, subdev_count, GFP_KERNEL); if (!vpif_obj.sd) { err = -ENOMEM; goto probe_subdev_out; diff --git a/drivers/media/platform/ti/davinci/vpif_display.c b/drivers/media/platform/ti/davinci/vpif_display.c index 1e7815e9f8e0..b8349ebcde33 100644 --- a/drivers/media/platform/ti/davinci/vpif_display.c +++ b/drivers/media/platform/ti/davinci/vpif_display.c @@ -1089,7 +1089,7 @@ static int initialize_vpif(void) /* Allocate memory for six channel objects */ for (i = 0; i < VPIF_DISPLAY_MAX_DEVICES; i++) { vpif_obj.dev[i] = - kzalloc(sizeof(struct channel_obj), GFP_KERNEL); + kzalloc_obj(struct channel_obj, GFP_KERNEL); /* If memory allocation fails, return error */ if (!vpif_obj.dev[i]) { free_channel_objects_index = i; @@ -1264,7 +1264,7 @@ static int vpif_probe(struct platform_device *pdev) vpif_obj.config = pdev->dev.platform_data; subdev_count = vpif_obj.config->subdev_count; subdevdata = vpif_obj.config->subdevinfo; - vpif_obj.sd = kcalloc(subdev_count, sizeof(*vpif_obj.sd), GFP_KERNEL); + vpif_obj.sd = kzalloc_objs(*vpif_obj.sd, subdev_count, GFP_KERNEL); if (!vpif_obj.sd) { err = -ENOMEM; goto vpif_unregister; diff --git a/drivers/media/platform/ti/omap/omap_vout.c b/drivers/media/platform/ti/omap/omap_vout.c index 22782e9f1f4e..b88c78d724d6 100644 --- a/drivers/media/platform/ti/omap/omap_vout.c +++ b/drivers/media/platform/ti/omap/omap_vout.c @@ -1452,7 +1452,7 @@ static int __init omap_vout_create_video_devices(struct platform_device *pdev) for (k = 0; k < pdev->num_resources; k++) { - vout = kzalloc(sizeof(struct omap_vout_device), GFP_KERNEL); + vout = kzalloc_obj(struct omap_vout_device, GFP_KERNEL); if (!vout) { dev_err(&pdev->dev, ": could not allocate memory\n"); return -ENOMEM; @@ -1611,7 +1611,7 @@ static int __init omap_vout_probe(struct platform_device *pdev) goto err_dss_init; } - vid_dev = kzalloc(sizeof(struct omap2video_device), GFP_KERNEL); + vid_dev = kzalloc_obj(struct omap2video_device, GFP_KERNEL); if (vid_dev == NULL) { ret = -ENOMEM; goto err_dss_init; diff --git a/drivers/media/platform/ti/omap3isp/isp.c b/drivers/media/platform/ti/omap3isp/isp.c index 8ac2bdcdf87b..23a433455459 100644 --- a/drivers/media/platform/ti/omap3isp/isp.c +++ b/drivers/media/platform/ti/omap3isp/isp.c @@ -2231,7 +2231,7 @@ static int isp_probe(struct platform_device *pdev) int ret; int i, m; - isp = kzalloc(sizeof(*isp), GFP_KERNEL); + isp = kzalloc_obj(*isp, GFP_KERNEL); if (!isp) { dev_err(&pdev->dev, "could not allocate memory\n"); return -ENOMEM; diff --git a/drivers/media/platform/ti/omap3isp/ispccdc.c b/drivers/media/platform/ti/omap3isp/ispccdc.c index 9dbf06ac058d..2e2daadbd575 100644 --- a/drivers/media/platform/ti/omap3isp/ispccdc.c +++ b/drivers/media/platform/ti/omap3isp/ispccdc.c @@ -419,7 +419,7 @@ static int ccdc_lsc_config(struct isp_ccdc_device *ccdc, return -EINVAL; } - req = kzalloc(sizeof(*req), GFP_KERNEL); + req = kzalloc_obj(*req, GFP_KERNEL); if (req == NULL) return -ENOMEM; diff --git a/drivers/media/platform/ti/omap3isp/isph3a_aewb.c b/drivers/media/platform/ti/omap3isp/isph3a_aewb.c index ae93da9c4542..1da1b71773bb 100644 --- a/drivers/media/platform/ti/omap3isp/isph3a_aewb.c +++ b/drivers/media/platform/ti/omap3isp/isph3a_aewb.c @@ -291,7 +291,7 @@ int omap3isp_h3a_aewb_init(struct isp_device *isp) struct omap3isp_h3a_aewb_config *aewb_recover_cfg = NULL; int ret; - aewb_cfg = kzalloc(sizeof(*aewb_cfg), GFP_KERNEL); + aewb_cfg = kzalloc_obj(*aewb_cfg, GFP_KERNEL); if (!aewb_cfg) return -ENOMEM; @@ -301,7 +301,7 @@ int omap3isp_h3a_aewb_init(struct isp_device *isp) aewb->isp = isp; /* Set recover state configuration */ - aewb_recover_cfg = kzalloc(sizeof(*aewb_recover_cfg), GFP_KERNEL); + aewb_recover_cfg = kzalloc_obj(*aewb_recover_cfg, GFP_KERNEL); if (!aewb_recover_cfg) { dev_err(aewb->isp->dev, "AEWB: cannot allocate memory for recover configuration.\n"); diff --git a/drivers/media/platform/ti/omap3isp/isph3a_af.c b/drivers/media/platform/ti/omap3isp/isph3a_af.c index ca478da4ad34..ff806d162529 100644 --- a/drivers/media/platform/ti/omap3isp/isph3a_af.c +++ b/drivers/media/platform/ti/omap3isp/isph3a_af.c @@ -354,7 +354,7 @@ int omap3isp_h3a_af_init(struct isp_device *isp) struct omap3isp_h3a_af_config *af_recover_cfg = NULL; int ret; - af_cfg = kzalloc(sizeof(*af_cfg), GFP_KERNEL); + af_cfg = kzalloc_obj(*af_cfg, GFP_KERNEL); if (af_cfg == NULL) return -ENOMEM; @@ -364,7 +364,7 @@ int omap3isp_h3a_af_init(struct isp_device *isp) af->isp = isp; /* Set recover state configuration */ - af_recover_cfg = kzalloc(sizeof(*af_recover_cfg), GFP_KERNEL); + af_recover_cfg = kzalloc_obj(*af_recover_cfg, GFP_KERNEL); if (!af_recover_cfg) { dev_err(af->isp->dev, "AF: cannot allocate memory for recover configuration.\n"); diff --git a/drivers/media/platform/ti/omap3isp/isphist.c b/drivers/media/platform/ti/omap3isp/isphist.c index 7851ad13d84f..8459fd9d5fc4 100644 --- a/drivers/media/platform/ti/omap3isp/isphist.c +++ b/drivers/media/platform/ti/omap3isp/isphist.c @@ -477,7 +477,7 @@ int omap3isp_hist_init(struct isp_device *isp) struct omap3isp_hist_config *hist_cfg; int ret; - hist_cfg = kzalloc(sizeof(*hist_cfg), GFP_KERNEL); + hist_cfg = kzalloc_obj(*hist_cfg, GFP_KERNEL); if (hist_cfg == NULL) return -ENOMEM; diff --git a/drivers/media/platform/ti/omap3isp/ispstat.c b/drivers/media/platform/ti/omap3isp/ispstat.c index 64bc71d830c4..ad34cc2c6f05 100644 --- a/drivers/media/platform/ti/omap3isp/ispstat.c +++ b/drivers/media/platform/ti/omap3isp/ispstat.c @@ -1047,7 +1047,7 @@ int omap3isp_stat_init(struct ispstat *stat, const char *name, { int ret; - stat->buf = kcalloc(STAT_MAX_BUFS, sizeof(*stat->buf), GFP_KERNEL); + stat->buf = kzalloc_objs(*stat->buf, STAT_MAX_BUFS, GFP_KERNEL); if (!stat->buf) return -ENOMEM; diff --git a/drivers/media/platform/ti/omap3isp/ispvideo.c b/drivers/media/platform/ti/omap3isp/ispvideo.c index 86cb27b6ca4e..f2a48387d158 100644 --- a/drivers/media/platform/ti/omap3isp/ispvideo.c +++ b/drivers/media/platform/ti/omap3isp/ispvideo.c @@ -1371,7 +1371,7 @@ static int isp_video_open(struct file *file) struct vb2_queue *queue; int ret = 0; - handle = kzalloc(sizeof(*handle), GFP_KERNEL); + handle = kzalloc_obj(*handle, GFP_KERNEL); if (handle == NULL) return -ENOMEM; diff --git a/drivers/media/platform/ti/vpe/vip.c b/drivers/media/platform/ti/vpe/vip.c index d4236ac6d867..33805f3b0a81 100644 --- a/drivers/media/platform/ti/vpe/vip.c +++ b/drivers/media/platform/ti/vpe/vip.c @@ -3035,7 +3035,7 @@ static int alloc_stream(struct vip_port *port, int stream_id, int vfl_type) struct list_head *pos, *tmp; int ret, i; - stream = kzalloc(sizeof(*stream), GFP_KERNEL); + stream = kzalloc_obj(*stream, GFP_KERNEL); if (!stream) return -ENOMEM; @@ -3079,7 +3079,7 @@ static int alloc_stream(struct vip_port *port, int stream_id, int vfl_type) /* Allocate/populate Drop queue entries */ INIT_LIST_HEAD(&stream->dropq); for (i = 0; i < VIP_DROPQ_SIZE; i++) { - buf = kzalloc(sizeof(*buf), GFP_ATOMIC); + buf = kzalloc_obj(*buf, GFP_ATOMIC); if (!buf) { ret = -ENOMEM; goto do_free_dropq; diff --git a/drivers/media/platform/ti/vpe/vpe.c b/drivers/media/platform/ti/vpe/vpe.c index 1a549775cabe..5effa0558f0f 100644 --- a/drivers/media/platform/ti/vpe/vpe.c +++ b/drivers/media/platform/ti/vpe/vpe.c @@ -2272,7 +2272,7 @@ static int vpe_open(struct file *file) vpe_dbg(dev, "vpe_open\n"); - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/verisilicon/hantro_drv.c b/drivers/media/platform/verisilicon/hantro_drv.c index 94f58f4e4a4e..0a14970f0472 100644 --- a/drivers/media/platform/verisilicon/hantro_drv.c +++ b/drivers/media/platform/verisilicon/hantro_drv.c @@ -640,7 +640,7 @@ static int hantro_open(struct file *filp) * helper functions used here. */ - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return -ENOMEM; diff --git a/drivers/media/platform/via/via-camera.c b/drivers/media/platform/via/via-camera.c index 5702eff664d4..fe8d94906e37 100644 --- a/drivers/media/platform/via/via-camera.c +++ b/drivers/media/platform/via/via-camera.c @@ -1164,7 +1164,7 @@ static int viacam_probe(struct platform_device *pdev) /* * Basic structure initialization. */ - cam = kzalloc (sizeof(struct via_camera), GFP_KERNEL); + cam = kzalloc_obj(struct via_camera, GFP_KERNEL); if (cam == NULL) return -ENOMEM; via_cam_info = cam; diff --git a/drivers/media/radio/dsbr100.c b/drivers/media/radio/dsbr100.c index 9a45cda05779..dab1deea05ea 100644 --- a/drivers/media/radio/dsbr100.c +++ b/drivers/media/radio/dsbr100.c @@ -338,7 +338,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, struct v4l2_device *v4l2_dev; int retval; - radio = kzalloc(sizeof(struct dsbr100_device), GFP_KERNEL); + radio = kzalloc_obj(struct dsbr100_device, GFP_KERNEL); if (!radio) return -ENOMEM; diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 2c1d413e8636..5a477ac9487b 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c @@ -67,7 +67,7 @@ struct rtrack { static struct radio_isa_card *rtrack_alloc(void) { - struct rtrack *rt = kzalloc(sizeof(struct rtrack), GFP_KERNEL); + struct rtrack *rt = kzalloc_obj(struct rtrack, GFP_KERNEL); if (rt) rt->curvol = 0xff; diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index 0a4667bb7034..4e4721ed61e7 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c @@ -82,7 +82,7 @@ static void aztech_set_pins(void *handle, u8 pins) static struct radio_isa_card *aztech_alloc(void) { - struct aztech *az = kzalloc(sizeof(*az), GFP_KERNEL); + struct aztech *az = kzalloc_obj(*az, GFP_KERNEL); return az ? &az->isa : NULL; } diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index a3265f1dd189..5f2637ffabae 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c @@ -179,7 +179,7 @@ static unsigned long gemtek_convfreq(unsigned long freq) static struct radio_isa_card *gemtek_alloc(void) { - struct gemtek *gt = kzalloc(sizeof(*gt), GFP_KERNEL); + struct gemtek *gt = kzalloc_obj(*gt, GFP_KERNEL); if (gt) gt->muted = true; diff --git a/drivers/media/radio/radio-keene.c b/drivers/media/radio/radio-keene.c index c133305fd019..a26da2e9fbab 100644 --- a/drivers/media/radio/radio-keene.c +++ b/drivers/media/radio/radio-keene.c @@ -311,7 +311,7 @@ static int usb_keene_probe(struct usb_interface *intf, if (dev->product && strcmp(dev->product, "B-LINK USB Audio ")) return -ENODEV; - radio = kzalloc(sizeof(struct keene_device), GFP_KERNEL); + radio = kzalloc_obj(struct keene_device, GFP_KERNEL); if (radio) radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); diff --git a/drivers/media/radio/radio-ma901.c b/drivers/media/radio/radio-ma901.c index 657c3dda6648..e768c40ab73d 100644 --- a/drivers/media/radio/radio-ma901.c +++ b/drivers/media/radio/radio-ma901.c @@ -346,7 +346,7 @@ static int usb_ma901radio_probe(struct usb_interface *intf, || strncmp(dev->manufacturer, "www.masterkit.ru", 16) != 0)) return -ENODEV; - radio = kzalloc(sizeof(struct ma901radio_device), GFP_KERNEL); + radio = kzalloc_obj(struct ma901radio_device, GFP_KERNEL); if (!radio) { dev_err(&intf->dev, "kzalloc for ma901radio_device failed\n"); retval = -ENOMEM; diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 1a5dbae24ef4..cfa0568791fd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c @@ -122,7 +122,7 @@ static int maxiradio_probe(struct pci_dev *pdev, struct v4l2_device *v4l2_dev; int retval = -ENOMEM; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { dev_err(&pdev->dev, "not enough memory\n"); return -ENOMEM; diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index cb0437b4c331..2e74f915c873 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c @@ -501,7 +501,7 @@ static int usb_amradio_probe(struct usb_interface *intf, struct amradio_device *radio; int retval; - radio = kzalloc(sizeof(struct amradio_device), GFP_KERNEL); + radio = kzalloc_obj(struct amradio_device, GFP_KERNEL); if (!radio) { dev_err(&intf->dev, "kmalloc for amradio_device failed\n"); diff --git a/drivers/media/radio/radio-raremono.c b/drivers/media/radio/radio-raremono.c index f60775b005e1..45b491ad1601 100644 --- a/drivers/media/radio/radio-raremono.c +++ b/drivers/media/radio/radio-raremono.c @@ -301,7 +301,7 @@ static int usb_raremono_probe(struct usb_interface *intf, struct raremono_device *radio; int retval = 0; - radio = kzalloc(sizeof(*radio), GFP_KERNEL); + radio = kzalloc_obj(*radio, GFP_KERNEL); if (!radio) return -ENOMEM; radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index efc02069bf9d..1e24e2d9cbbc 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c @@ -47,7 +47,7 @@ MODULE_PARM_DESC(radio_nr, "Radio device numbers"); static struct radio_isa_card *rtrack2_alloc(void) { - return kzalloc(sizeof(struct radio_isa_card), GFP_KERNEL); + return kzalloc_obj(struct radio_isa_card, GFP_KERNEL); } static void zero(struct radio_isa_card *isa) diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index d0dde55b7930..cdd489ca2d9a 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c @@ -252,7 +252,7 @@ static int fmr2_probe(struct fmr2 *fmr2, struct device *pdev, int io) static int fmr2_isa_match(struct device *pdev, unsigned int ndev) { - struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); + struct fmr2 *fmr2 = kzalloc_obj(*fmr2, GFP_KERNEL); if (!fmr2) return 0; @@ -269,7 +269,7 @@ static int fmr2_isa_match(struct device *pdev, unsigned int ndev) static int fmr2_pnp_probe(struct pnp_dev *pdev, const struct pnp_device_id *id) { int ret; - struct fmr2 *fmr2 = kzalloc(sizeof(*fmr2), GFP_KERNEL); + struct fmr2 *fmr2 = kzalloc_obj(*fmr2, GFP_KERNEL); if (!fmr2) return -ENOMEM; diff --git a/drivers/media/radio/radio-shark.c b/drivers/media/radio/radio-shark.c index 127a3be0e0f0..381196d6c675 100644 --- a/drivers/media/radio/radio-shark.c +++ b/drivers/media/radio/radio-shark.c @@ -327,7 +327,7 @@ static int usb_shark_probe(struct usb_interface *intf, return -EINVAL; } - shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); + shark = kzalloc_obj(struct shark_device, GFP_KERNEL); if (!shark) return retval; diff --git a/drivers/media/radio/radio-shark2.c b/drivers/media/radio/radio-shark2.c index e3e6aa87fe08..9e1d00d6bac1 100644 --- a/drivers/media/radio/radio-shark2.c +++ b/drivers/media/radio/radio-shark2.c @@ -293,7 +293,7 @@ static int usb_shark_probe(struct usb_interface *intf, return -EINVAL; } - shark = kzalloc(sizeof(struct shark_device), GFP_KERNEL); + shark = kzalloc_obj(struct shark_device, GFP_KERNEL); if (!shark) return retval; diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index dd85b0b1bcd9..ec953b8cb7ab 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c @@ -420,7 +420,7 @@ static int tea5764_i2c_probe(struct i2c_client *client) int ret; PDEBUG("probe"); - radio = kzalloc(sizeof(struct tea5764_device), GFP_KERNEL); + radio = kzalloc_obj(struct tea5764_device, GFP_KERNEL); if (!radio) return -ENOMEM; diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index 43817dd0a0fe..a160bcc2643f 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c @@ -56,7 +56,7 @@ MODULE_PARM_DESC(radio_nr, "Radio device number"); static struct radio_isa_card *terratec_alloc(void) { - return kzalloc(sizeof(struct radio_isa_card), GFP_KERNEL); + return kzalloc_obj(struct radio_isa_card, GFP_KERNEL); } static int terratec_s_mute_volume(struct radio_isa_card *isa, bool mute, int vol) diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index dfb8b62f0e2b..31d5e5efafaa 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c @@ -55,7 +55,7 @@ struct trust { static struct radio_isa_card *trust_alloc(void) { - struct trust *tr = kzalloc(sizeof(*tr), GFP_KERNEL); + struct trust *tr = kzalloc_obj(*tr, GFP_KERNEL); return tr ? &tr->isa : NULL; } diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index 1aa856df70df..4c49d9103135 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c @@ -75,7 +75,7 @@ struct typhoon { static struct radio_isa_card *typhoon_alloc(void) { - struct typhoon *ty = kzalloc(sizeof(*ty), GFP_KERNEL); + struct typhoon *ty = kzalloc_obj(*ty, GFP_KERNEL); return ty ? &ty->isa : NULL; } diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index e043bee52384..cf1a823e0aa9 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c @@ -79,7 +79,7 @@ struct zoltrix { static struct radio_isa_card *zoltrix_alloc(void) { - struct zoltrix *zol = kzalloc(sizeof(*zol), GFP_KERNEL); + struct zoltrix *zol = kzalloc_obj(*zol, GFP_KERNEL); return zol ? &zol->isa : NULL; } diff --git a/drivers/media/radio/saa7706h.c b/drivers/media/radio/saa7706h.c index d9eecddffd91..71850c3b02a4 100644 --- a/drivers/media/radio/saa7706h.c +++ b/drivers/media/radio/saa7706h.c @@ -344,7 +344,7 @@ static int saa7706h_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - state = kzalloc(sizeof(struct saa7706h_state), GFP_KERNEL); + state = kzalloc_obj(struct saa7706h_state, GFP_KERNEL); if (state == NULL) return -ENOMEM; sd = &state->sd; diff --git a/drivers/media/radio/si470x/radio-si470x-usb.c b/drivers/media/radio/si470x/radio-si470x-usb.c index aa7a580dbecc..79208c0b5c4a 100644 --- a/drivers/media/radio/si470x/radio-si470x-usb.c +++ b/drivers/media/radio/si470x/radio-si470x-usb.c @@ -570,7 +570,7 @@ static int si470x_usb_driver_probe(struct usb_interface *intf, unsigned char version_warning = 0; /* private data allocation and initialization */ - radio = kzalloc(sizeof(struct si470x_device), GFP_KERNEL); + radio = kzalloc_obj(struct si470x_device, GFP_KERNEL); if (!radio) { retval = -ENOMEM; goto err_initial; diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c b/drivers/media/radio/si4713/radio-usb-si4713.c index 2cf36c8abdde..a4bfda695413 100644 --- a/drivers/media/radio/si4713/radio-usb-si4713.c +++ b/drivers/media/radio/si4713/radio-usb-si4713.c @@ -420,7 +420,7 @@ static int usb_si4713_probe(struct usb_interface *intf, id->idVendor, id->idProduct); /* Initialize local device structure */ - radio = kzalloc(sizeof(struct si4713_usb_device), GFP_KERNEL); + radio = kzalloc_obj(struct si4713_usb_device, GFP_KERNEL); if (radio) radio->buffer = kmalloc(BUFFER_LENGTH, GFP_KERNEL); diff --git a/drivers/media/radio/tef6862.c b/drivers/media/radio/tef6862.c index b00ccf651922..7f95498a5551 100644 --- a/drivers/media/radio/tef6862.c +++ b/drivers/media/radio/tef6862.c @@ -153,7 +153,7 @@ static int tef6862_probe(struct i2c_client *client) v4l_info(client, "chip found @ 0x%02x (%s)\n", client->addr << 1, client->adapter->name); - state = kzalloc(sizeof(struct tef6862_state), GFP_KERNEL); + state = kzalloc_obj(struct tef6862_state, GFP_KERNEL); if (state == NULL) return -ENOMEM; state->freq = TEF6862_LO_FREQ; diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index a733914a2574..6bde5c913e99 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -839,7 +839,7 @@ static int ati_remote_probe(struct usb_interface *interface, return -ENODEV; } - ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); + ati_remote = kzalloc_obj(struct ati_remote, GFP_KERNEL); rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!ati_remote || !rc_dev) goto exit_free_dev_rdev; diff --git a/drivers/media/rc/ene_ir.c b/drivers/media/rc/ene_ir.c index d6c54a3bccc2..6e61173ba233 100644 --- a/drivers/media/rc/ene_ir.c +++ b/drivers/media/rc/ene_ir.c @@ -993,7 +993,7 @@ static int ene_probe(struct pnp_dev *pnp_dev, const struct pnp_device_id *id) struct ene_device *dev; /* allocate memory */ - dev = kzalloc(sizeof(struct ene_device), GFP_KERNEL); + dev = kzalloc_obj(struct ene_device, GFP_KERNEL); rdev = rc_allocate_device(RC_DRIVER_IR_RAW); if (!dev || !rdev) goto exit_free_dev_rdev; diff --git a/drivers/media/rc/fintek-cir.c b/drivers/media/rc/fintek-cir.c index 3fb0968efd57..92a38d04d979 100644 --- a/drivers/media/rc/fintek-cir.c +++ b/drivers/media/rc/fintek-cir.c @@ -465,7 +465,7 @@ static int fintek_probe(struct pnp_dev *pdev, const struct pnp_device_id *dev_id struct rc_dev *rdev; int ret = -ENOMEM; - fintek = kzalloc(sizeof(struct fintek_dev), GFP_KERNEL); + fintek = kzalloc_obj(struct fintek_dev, GFP_KERNEL); if (!fintek) return ret; diff --git a/drivers/media/rc/iguanair.c b/drivers/media/rc/iguanair.c index 8af94246e591..bb5bd62c8645 100644 --- a/drivers/media/rc/iguanair.c +++ b/drivers/media/rc/iguanair.c @@ -392,7 +392,7 @@ static int iguanair_probe(struct usb_interface *intf, if (idesc->desc.bNumEndpoints < 2) return -ENODEV; - ir = kzalloc(sizeof(*ir), GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !rc) { ret = -ENOMEM; diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 35b9e07003d8..0cb2ad180728 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -614,7 +614,7 @@ static int send_packet(struct imon_context *ictx) ictx->tx_urb->actual_length = 0; } else { /* fill request into kmalloc'ed space: */ - control_req = kmalloc(sizeof(*control_req), GFP_KERNEL); + control_req = kmalloc_obj(*control_req, GFP_KERNEL); if (control_req == NULL) return -ENOMEM; @@ -2233,7 +2233,7 @@ static struct imon_context *imon_init_intf0(struct usb_interface *intf, struct usb_host_interface *iface_desc; int ret = -ENOMEM; - ictx = kzalloc(sizeof(*ictx), GFP_KERNEL); + ictx = kzalloc_obj(*ictx, GFP_KERNEL); if (!ictx) goto exit; diff --git a/drivers/media/rc/ir_toy.c b/drivers/media/rc/ir_toy.c index 533faa117517..cf3b27817131 100644 --- a/drivers/media/rc/ir_toy.c +++ b/drivers/media/rc/ir_toy.c @@ -418,7 +418,7 @@ static int irtoy_probe(struct usb_interface *intf, return -ENODEV; } - irtoy = kzalloc(sizeof(*irtoy), GFP_KERNEL); + irtoy = kzalloc_obj(*irtoy, GFP_KERNEL); if (!irtoy) return -ENOMEM; diff --git a/drivers/media/rc/ite-cir.c b/drivers/media/rc/ite-cir.c index 2bacecb02262..448f5c5db616 100644 --- a/drivers/media/rc/ite-cir.c +++ b/drivers/media/rc/ite-cir.c @@ -1304,7 +1304,7 @@ static int ite_probe(struct pnp_dev *pdev, const struct pnp_device_id int model_no; int io_rsrc_no; - itdev = kzalloc(sizeof(struct ite_dev), GFP_KERNEL); + itdev = kzalloc_obj(struct ite_dev, GFP_KERNEL); if (!itdev) return ret; diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 7d4942925993..735b0630b172 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -128,7 +128,7 @@ static int lirc_open(struct inode *inode, struct file *file) { struct rc_dev *dev = container_of(inode->i_cdev, struct rc_dev, lirc_cdev); - struct lirc_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); + struct lirc_fh *fh = kzalloc_obj(*fh, GFP_KERNEL); unsigned long flags; int retval; @@ -267,7 +267,7 @@ static ssize_t lirc_transmit(struct file *file, const char __user *buf, goto out_unlock; } - raw = kmalloc_array(LIRCBUF_SIZE, sizeof(*raw), GFP_KERNEL); + raw = kmalloc_objs(*raw, LIRCBUF_SIZE, GFP_KERNEL); if (!raw) { ret = -ENOMEM; goto out_unlock; diff --git a/drivers/media/rc/mceusb.c b/drivers/media/rc/mceusb.c index 044767eb3a38..d35fff006ac9 100644 --- a/drivers/media/rc/mceusb.c +++ b/drivers/media/rc/mceusb.c @@ -1715,7 +1715,7 @@ static int mceusb_dev_probe(struct usb_interface *intf, pipe = usb_rcvbulkpipe(dev, ep_in->bEndpointAddress); maxp = usb_maxpacket(dev, pipe); - ir = kzalloc(sizeof(struct mceusb_dev), GFP_KERNEL); + ir = kzalloc_obj(struct mceusb_dev, GFP_KERNEL); if (!ir) goto mem_alloc_fail; diff --git a/drivers/media/rc/nuvoton-cir.c b/drivers/media/rc/nuvoton-cir.c index 2214d41ef579..4cf74ac2d76c 100644 --- a/drivers/media/rc/nuvoton-cir.c +++ b/drivers/media/rc/nuvoton-cir.c @@ -639,7 +639,7 @@ static int nvt_ir_raw_set_wakeup_filter(struct rc_dev *dev, if (!sc_filter->mask) return 0; - raw = kmalloc_array(WAKEUP_MAX_SIZE, sizeof(*raw), GFP_KERNEL); + raw = kmalloc_objs(*raw, WAKEUP_MAX_SIZE, GFP_KERNEL); if (!raw) return -ENOMEM; diff --git a/drivers/media/rc/rc-ir-raw.c b/drivers/media/rc/rc-ir-raw.c index 5dafe11f61c6..d1f8bb6af874 100644 --- a/drivers/media/rc/rc-ir-raw.c +++ b/drivers/media/rc/rc-ir-raw.c @@ -615,7 +615,7 @@ int ir_raw_event_prepare(struct rc_dev *dev) if (!dev) return -EINVAL; - dev->raw = kzalloc(sizeof(*dev->raw), GFP_KERNEL); + dev->raw = kzalloc_obj(*dev->raw, GFP_KERNEL); if (!dev->raw) return -ENOMEM; diff --git a/drivers/media/rc/rc-loopback.c b/drivers/media/rc/rc-loopback.c index 8288366f891f..959a1167d376 100644 --- a/drivers/media/rc/rc-loopback.c +++ b/drivers/media/rc/rc-loopback.c @@ -185,7 +185,7 @@ static int loop_set_wakeup_filter(struct rc_dev *dev, return 0; /* encode the specified filter and loop it back */ - raw = kmalloc_array(max, sizeof(*raw), GFP_KERNEL); + raw = kmalloc_objs(*raw, max, GFP_KERNEL); if (!raw) return -ENOMEM; diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c index b9bf5cdcde4a..b67af602fbe6 100644 --- a/drivers/media/rc/rc-main.c +++ b/drivers/media/rc/rc-main.c @@ -1701,7 +1701,7 @@ struct rc_dev *rc_allocate_device(enum rc_driver_type type) { struct rc_dev *dev; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return NULL; diff --git a/drivers/media/rc/redrat3.c b/drivers/media/rc/redrat3.c index a49173f54a4d..2471bb4d66b8 100644 --- a/drivers/media/rc/redrat3.c +++ b/drivers/media/rc/redrat3.c @@ -502,7 +502,7 @@ static int redrat3_set_timeout(struct rc_dev *rc_dev, unsigned int timeoutus) __be32 *timeout; int ret; - timeout = kmalloc(sizeof(*timeout), GFP_KERNEL); + timeout = kmalloc_obj(*timeout, GFP_KERNEL); if (!timeout) return -ENOMEM; @@ -768,13 +768,11 @@ static int redrat3_transmit_ir(struct rc_dev *rcdev, unsigned *txbuf, /* rr3 will disable rc detector on transmit */ rr3->transmitting = true; - sample_lens = kcalloc(RR3_DRIVER_MAXLENS, - sizeof(*sample_lens), - GFP_KERNEL); + sample_lens = kzalloc_objs(*sample_lens, RR3_DRIVER_MAXLENS, GFP_KERNEL); if (!sample_lens) return -ENOMEM; - irdata = kzalloc(sizeof(*irdata), GFP_KERNEL); + irdata = kzalloc_obj(*irdata, GFP_KERNEL); if (!irdata) { ret = -ENOMEM; goto out; @@ -1022,7 +1020,7 @@ static int redrat3_dev_probe(struct usb_interface *intf, } /* allocate memory for our device state and initialize it */ - rr3 = kzalloc(sizeof(*rr3), GFP_KERNEL); + rr3 = kzalloc_obj(*rr3, GFP_KERNEL); if (!rr3) goto no_endpoints; diff --git a/drivers/media/rc/streamzap.c b/drivers/media/rc/streamzap.c index d3b48a0dd1f4..38e0db1b4964 100644 --- a/drivers/media/rc/streamzap.c +++ b/drivers/media/rc/streamzap.c @@ -285,7 +285,7 @@ static int streamzap_probe(struct usb_interface *intf, int pipe, maxp; /* Allocate space for device driver specific data */ - sz = kzalloc(sizeof(struct streamzap_ir), GFP_KERNEL); + sz = kzalloc_obj(struct streamzap_ir, GFP_KERNEL); if (!sz) return -ENOMEM; diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c index 560a26f3965c..8b70c1e809ed 100644 --- a/drivers/media/rc/ttusbir.c +++ b/drivers/media/rc/ttusbir.c @@ -187,7 +187,7 @@ static int ttusbir_probe(struct usb_interface *intf, int i, j, ret; int altsetting = -1; - tt = kzalloc(sizeof(*tt), GFP_KERNEL); + tt = kzalloc_obj(*tt, GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!tt || !rc) { ret = -ENOMEM; diff --git a/drivers/media/rc/winbond-cir.c b/drivers/media/rc/winbond-cir.c index 25884a79985c..875ead5240a5 100644 --- a/drivers/media/rc/winbond-cir.c +++ b/drivers/media/rc/winbond-cir.c @@ -1017,7 +1017,7 @@ wbcir_probe(struct pnp_dev *device, const struct pnp_device_id *dev_id) return -ENODEV; } - data = kzalloc(sizeof(*data), GFP_KERNEL); + data = kzalloc_obj(*data, GFP_KERNEL); if (!data) { err = -ENOMEM; goto exit; diff --git a/drivers/media/rc/xbox_remote.c b/drivers/media/rc/xbox_remote.c index a1572381d097..79c3bfe60437 100644 --- a/drivers/media/rc/xbox_remote.c +++ b/drivers/media/rc/xbox_remote.c @@ -213,7 +213,7 @@ static int xbox_remote_probe(struct usb_interface *interface, return -ENODEV; } - xbox_remote = kzalloc(sizeof(*xbox_remote), GFP_KERNEL); + xbox_remote = kzalloc_obj(*xbox_remote, GFP_KERNEL); rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE); if (!xbox_remote || !rc_dev) goto exit_free_dev_rdev; diff --git a/drivers/media/spi/cxd2880-spi.c b/drivers/media/spi/cxd2880-spi.c index 65fa7f857fca..352ff42b9121 100644 --- a/drivers/media/spi/cxd2880-spi.c +++ b/drivers/media/spi/cxd2880-spi.c @@ -516,7 +516,7 @@ cxd2880_spi_probe(struct spi_device *spi) return -EINVAL; } - dvb_spi = kzalloc(sizeof(struct cxd2880_dvb_spi), GFP_KERNEL); + dvb_spi = kzalloc_obj(struct cxd2880_dvb_spi, GFP_KERNEL); if (!dvb_spi) return -ENOMEM; diff --git a/drivers/media/test-drivers/vicodec/vicodec-core.c b/drivers/media/test-drivers/vicodec/vicodec-core.c index be846f711969..d3d4bb41c8ea 100644 --- a/drivers/media/test-drivers/vicodec/vicodec-core.c +++ b/drivers/media/test-drivers/vicodec/vicodec-core.c @@ -1836,7 +1836,7 @@ static int vicodec_open(struct file *file) if (mutex_lock_interruptible(vfd->lock)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { rc = -ENOMEM; goto open_unlock; @@ -2105,7 +2105,7 @@ static int vicodec_probe(struct platform_device *pdev) struct vicodec_dev *dev; int ret; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/test-drivers/vidtv/vidtv_bridge.c b/drivers/media/test-drivers/vidtv/vidtv_bridge.c index 438483c62fac..03bb7c79df47 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_bridge.c +++ b/drivers/media/test-drivers/vidtv/vidtv_bridge.c @@ -490,7 +490,7 @@ static int vidtv_bridge_probe(struct platform_device *pdev) struct vidtv_dvb *dvb; int ret; - dvb = kzalloc(sizeof(*dvb), GFP_KERNEL); + dvb = kzalloc_obj(*dvb, GFP_KERNEL); if (!dvb) return -ENOMEM; diff --git a/drivers/media/test-drivers/vidtv/vidtv_channel.c b/drivers/media/test-drivers/vidtv/vidtv_channel.c index 3541155c6fc6..4ba65853c3ed 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_channel.c +++ b/drivers/media/test-drivers/vidtv/vidtv_channel.c @@ -67,7 +67,7 @@ struct vidtv_channel const u16 s302m_beethoven_event_id = 1; struct vidtv_channel *s302m; - s302m = kzalloc(sizeof(*s302m), GFP_KERNEL); + s302m = kzalloc_obj(*s302m, GFP_KERNEL); if (!s302m) return NULL; @@ -389,7 +389,7 @@ static struct vidtv_psi_desc_service_list_entry s_desc = (struct vidtv_psi_desc_service *)desc; - curr_e = kzalloc(sizeof(*curr_e), GFP_KERNEL); + curr_e = kzalloc_obj(*curr_e, GFP_KERNEL); if (!curr_e) { vidtv_channel_destroy_service_list(head_e); return NULL; diff --git a/drivers/media/test-drivers/vidtv/vidtv_demod.c b/drivers/media/test-drivers/vidtv/vidtv_demod.c index 505f96fccbf3..31ee6d706744 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_demod.c +++ b/drivers/media/test-drivers/vidtv/vidtv_demod.c @@ -418,7 +418,7 @@ static int vidtv_demod_i2c_probe(struct i2c_client *client) struct vidtv_demod_state *state; /* allocate memory for the internal state */ - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return -ENOMEM; diff --git a/drivers/media/test-drivers/vidtv/vidtv_mux.c b/drivers/media/test-drivers/vidtv/vidtv_mux.c index f99878eff7ac..01bed6d82437 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_mux.c +++ b/drivers/media/test-drivers/vidtv/vidtv_mux.c @@ -50,7 +50,7 @@ static struct vidtv_mux_pid_ctx if (ctx) return ctx; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) return NULL; @@ -480,7 +480,7 @@ struct vidtv_mux *vidtv_mux_init(struct dvb_frontend *fe, { struct vidtv_mux *m; - m = kzalloc(sizeof(*m), GFP_KERNEL); + m = kzalloc_obj(*m, GFP_KERNEL); if (!m) return NULL; diff --git a/drivers/media/test-drivers/vidtv/vidtv_psi.c b/drivers/media/test-drivers/vidtv/vidtv_psi.c index 2a51c898c11e..2cd3f5d7c142 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_psi.c +++ b/drivers/media/test-drivers/vidtv/vidtv_psi.c @@ -285,7 +285,7 @@ struct vidtv_psi_desc_service *vidtv_psi_service_desc_init(struct vidtv_psi_desc u32 service_name_len = service_name ? strlen(service_name) : 0; u32 provider_name_len = provider_name ? strlen(provider_name) : 0; - desc = kzalloc(sizeof(*desc), GFP_KERNEL); + desc = kzalloc_obj(*desc, GFP_KERNEL); if (!desc) return NULL; @@ -360,7 +360,7 @@ struct vidtv_psi_desc_network_name u32 network_name_len = network_name ? strlen(network_name) : 0; struct vidtv_psi_desc_network_name *desc; - desc = kzalloc(sizeof(*desc), GFP_KERNEL); + desc = kzalloc_obj(*desc, GFP_KERNEL); if (!desc) return NULL; @@ -390,14 +390,14 @@ struct vidtv_psi_desc_service_list struct vidtv_psi_desc_service_list *desc; u16 length = 0; - desc = kzalloc(sizeof(*desc), GFP_KERNEL); + desc = kzalloc_obj(*desc, GFP_KERNEL); if (!desc) return NULL; desc->type = SERVICE_LIST_DESCRIPTOR; while (entry) { - curr_e = kzalloc(sizeof(*curr_e), GFP_KERNEL); + curr_e = kzalloc_obj(*curr_e, GFP_KERNEL); if (!curr_e) { while (head_e) { curr_e = head_e; @@ -441,7 +441,7 @@ struct vidtv_psi_desc_short_event struct vidtv_psi_desc_short_event *desc; u32 text_len = text ? strlen(text) : 0; - desc = kzalloc(sizeof(*desc), GFP_KERNEL); + desc = kzalloc_obj(*desc, GFP_KERNEL); if (!desc) return NULL; @@ -895,7 +895,7 @@ vidtv_psi_pat_program_init(struct vidtv_psi_table_pat_program *head, struct vidtv_psi_table_pat_program *program; const u16 RESERVED = 0x07; - program = kzalloc(sizeof(*program), GFP_KERNEL); + program = kzalloc_obj(*program, GFP_KERNEL); if (!program) return NULL; @@ -967,7 +967,7 @@ struct vidtv_psi_table_pat *vidtv_psi_pat_table_init(u16 transport_stream_id) const u16 ZERO = 0x0; const u16 ONES = 0x03; - pat = kzalloc(sizeof(*pat), GFP_KERNEL); + pat = kzalloc_obj(*pat, GFP_KERNEL); if (!pat) return NULL; @@ -1067,7 +1067,7 @@ vidtv_psi_pmt_stream_init(struct vidtv_psi_table_pmt_stream *head, const u16 ZERO = 0x0; u16 desc_loop_len; - stream = kzalloc(sizeof(*stream), GFP_KERNEL); + stream = kzalloc_obj(*stream, GFP_KERNEL); if (!stream) return NULL; @@ -1153,7 +1153,7 @@ struct vidtv_psi_table_pmt *vidtv_psi_pmt_table_init(u16 program_number, const u16 ZERO = 0x0; u16 desc_loop_len; - pmt = kzalloc(sizeof(*pmt), GFP_KERNEL); + pmt = kzalloc_obj(*pmt, GFP_KERNEL); if (!pmt) return NULL; @@ -1298,7 +1298,7 @@ struct vidtv_psi_table_sdt *vidtv_psi_sdt_table_init(u16 network_id, const u16 ONES = 0x03; const u16 ONE = 0x1; - sdt = kzalloc(sizeof(*sdt), GFP_KERNEL); + sdt = kzalloc_obj(*sdt, GFP_KERNEL); if (!sdt) return NULL; @@ -1438,7 +1438,7 @@ struct vidtv_psi_table_sdt_service { struct vidtv_psi_table_sdt_service *service; - service = kzalloc(sizeof(*service), GFP_KERNEL); + service = kzalloc_obj(*service, GFP_KERNEL); if (!service) return NULL; @@ -1523,9 +1523,8 @@ vidtv_psi_pmt_create_sec_for_each_pat_entry(struct vidtv_psi_table_pat *pat, program = program->next; } - pmt_secs = kcalloc(num_pmt, - sizeof(struct vidtv_psi_table_pmt *), - GFP_KERNEL); + pmt_secs = kzalloc_objs(struct vidtv_psi_table_pmt *, num_pmt, + GFP_KERNEL); if (!pmt_secs) return NULL; @@ -1622,11 +1621,11 @@ struct vidtv_psi_table_nit const u16 ONES = 0x03; const u16 ONE = 0x1; - nit = kzalloc(sizeof(*nit), GFP_KERNEL); + nit = kzalloc_obj(*nit, GFP_KERNEL); if (!nit) return NULL; - transport = kzalloc(sizeof(*transport), GFP_KERNEL); + transport = kzalloc_obj(*transport, GFP_KERNEL); if (!transport) goto free_nit; @@ -1857,7 +1856,7 @@ struct vidtv_psi_table_eit const u16 ONE = 0x1; const u16 ONES = 0x03; - eit = kzalloc(sizeof(*eit), GFP_KERNEL); + eit = kzalloc_obj(*eit, GFP_KERNEL); if (!eit) return NULL; @@ -1982,7 +1981,7 @@ struct vidtv_psi_table_eit_event int mjd, l; __be16 mjd_be; - e = kzalloc(sizeof(*e), GFP_KERNEL); + e = kzalloc_obj(*e, GFP_KERNEL); if (!e) return NULL; diff --git a/drivers/media/test-drivers/vidtv/vidtv_s302m.c b/drivers/media/test-drivers/vidtv/vidtv_s302m.c index 9da18eac04b5..1a2ffcf0796f 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_s302m.c +++ b/drivers/media/test-drivers/vidtv/vidtv_s302m.c @@ -148,7 +148,7 @@ static struct vidtv_access_unit *vidtv_s302m_access_unit_init(struct vidtv_acces { struct vidtv_access_unit *au; - au = kzalloc(sizeof(*au), GFP_KERNEL); + au = kzalloc_obj(*au, GFP_KERNEL); if (!au) return NULL; @@ -445,7 +445,7 @@ struct vidtv_encoder struct vidtv_s302m_ctx *ctx; struct vidtv_encoder *e; - e = kzalloc(sizeof(*e), GFP_KERNEL); + e = kzalloc_obj(*e, GFP_KERNEL); if (!e) return NULL; diff --git a/drivers/media/test-drivers/vidtv/vidtv_tuner.c b/drivers/media/test-drivers/vidtv/vidtv_tuner.c index 4ba302d569d6..735eb3b6824d 100644 --- a/drivers/media/test-drivers/vidtv/vidtv_tuner.c +++ b/drivers/media/test-drivers/vidtv/vidtv_tuner.c @@ -396,7 +396,7 @@ static int vidtv_tuner_i2c_probe(struct i2c_client *client) struct dvb_frontend *fe = config->fe; struct vidtv_tuner_dev *tuner_dev = NULL; - tuner_dev = kzalloc(sizeof(*tuner_dev), GFP_KERNEL); + tuner_dev = kzalloc_obj(*tuner_dev, GFP_KERNEL); if (!tuner_dev) return -ENOMEM; diff --git a/drivers/media/test-drivers/vim2m.c b/drivers/media/test-drivers/vim2m.c index c33c18ea5210..ae091cb67794 100644 --- a/drivers/media/test-drivers/vim2m.c +++ b/drivers/media/test-drivers/vim2m.c @@ -1365,7 +1365,7 @@ static int vim2m_open(struct file *file) if (mutex_lock_interruptible(&dev->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { rc = -ENOMEM; goto open_unlock; @@ -1492,7 +1492,7 @@ static int vim2m_probe(struct platform_device *pdev) struct video_device *vfd; int ret; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/test-drivers/vimc/vimc-capture.c b/drivers/media/test-drivers/vimc/vimc-capture.c index 7f6124025fc9..e8a91f78a484 100644 --- a/drivers/media/test-drivers/vimc/vimc-capture.c +++ b/drivers/media/test-drivers/vimc/vimc-capture.c @@ -397,7 +397,7 @@ static struct vimc_ent_device *vimc_capture_add(struct vimc_device *vimc, int ret; /* Allocate the vimc_capture_device struct */ - vcapture = kzalloc(sizeof(*vcapture), GFP_KERNEL); + vcapture = kzalloc_obj(*vcapture, GFP_KERNEL); if (!vcapture) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/test-drivers/vimc/vimc-core.c b/drivers/media/test-drivers/vimc/vimc-core.c index f632c77e52f5..7267766662fa 100644 --- a/drivers/media/test-drivers/vimc/vimc-core.c +++ b/drivers/media/test-drivers/vimc/vimc-core.c @@ -287,8 +287,8 @@ static int vimc_register_devices(struct vimc_device *vimc) return ret; } /* allocate ent_devs */ - vimc->ent_devs = kcalloc(vimc->pipe_cfg->num_ents, - sizeof(*vimc->ent_devs), GFP_KERNEL); + vimc->ent_devs = kzalloc_objs(*vimc->ent_devs, vimc->pipe_cfg->num_ents, + GFP_KERNEL); if (!vimc->ent_devs) { ret = -ENOMEM; goto err_v4l2_unregister; @@ -354,7 +354,7 @@ static int vimc_probe(struct platform_device *pdev) if (vimc_allocator == VIMC_ALLOCATOR_DMA_CONTIG) dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); - vimc = kzalloc(sizeof(*vimc), GFP_KERNEL); + vimc = kzalloc_obj(*vimc, GFP_KERNEL); if (!vimc) return -ENOMEM; diff --git a/drivers/media/test-drivers/vimc/vimc-debayer.c b/drivers/media/test-drivers/vimc/vimc-debayer.c index bbb7c7a86df0..9f86944a04a5 100644 --- a/drivers/media/test-drivers/vimc/vimc-debayer.c +++ b/drivers/media/test-drivers/vimc/vimc-debayer.c @@ -564,7 +564,7 @@ static struct vimc_ent_device *vimc_debayer_add(struct vimc_device *vimc, int ret; /* Allocate the vdebayer struct */ - vdebayer = kzalloc(sizeof(*vdebayer), GFP_KERNEL); + vdebayer = kzalloc_obj(*vdebayer, GFP_KERNEL); if (!vdebayer) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/test-drivers/vimc/vimc-lens.c b/drivers/media/test-drivers/vimc/vimc-lens.c index 96399057a2b5..9b7909ded8d6 100644 --- a/drivers/media/test-drivers/vimc/vimc-lens.c +++ b/drivers/media/test-drivers/vimc/vimc-lens.c @@ -54,7 +54,7 @@ static struct vimc_ent_device *vimc_lens_add(struct vimc_device *vimc, int ret; /* Allocate the vlens struct */ - vlens = kzalloc(sizeof(*vlens), GFP_KERNEL); + vlens = kzalloc_obj(*vlens, GFP_KERNEL); if (!vlens) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/test-drivers/vimc/vimc-scaler.c b/drivers/media/test-drivers/vimc/vimc-scaler.c index 47d0d63865a0..eb0a45944e4f 100644 --- a/drivers/media/test-drivers/vimc/vimc-scaler.c +++ b/drivers/media/test-drivers/vimc/vimc-scaler.c @@ -392,7 +392,7 @@ static struct vimc_ent_device *vimc_scaler_add(struct vimc_device *vimc, int ret; /* Allocate the vscaler struct */ - vscaler = kzalloc(sizeof(*vscaler), GFP_KERNEL); + vscaler = kzalloc_obj(*vscaler, GFP_KERNEL); if (!vscaler) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/test-drivers/vimc/vimc-sensor.c b/drivers/media/test-drivers/vimc/vimc-sensor.c index 027767777763..e53d28e59ac3 100644 --- a/drivers/media/test-drivers/vimc/vimc-sensor.c +++ b/drivers/media/test-drivers/vimc/vimc-sensor.c @@ -382,7 +382,7 @@ static struct vimc_ent_device *vimc_sensor_add(struct vimc_device *vimc, int ret; /* Allocate the vsensor struct */ - vsensor = kzalloc(sizeof(*vsensor), GFP_KERNEL); + vsensor = kzalloc_obj(*vsensor, GFP_KERNEL); if (!vsensor) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/test-drivers/visl/visl-core.c b/drivers/media/test-drivers/visl/visl-core.c index 26c6c6835f79..5ef662fa6cfa 100644 --- a/drivers/media/test-drivers/visl/visl-core.c +++ b/drivers/media/test-drivers/visl/visl-core.c @@ -332,7 +332,7 @@ static int visl_open(struct file *file) if (mutex_lock_interruptible(&dev->dev_mutex)) return -ERESTARTSYS; - ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); + ctx = kzalloc_obj(*ctx, GFP_KERNEL); if (!ctx) { rc = -ENOMEM; goto unlock; @@ -437,7 +437,7 @@ static int visl_probe(struct platform_device *pdev) int ret; int rc; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/test-drivers/visl/visl-debugfs.c b/drivers/media/test-drivers/visl/visl-debugfs.c index 45f2a8268014..8cb75c63aca6 100644 --- a/drivers/media/test-drivers/visl/visl-debugfs.c +++ b/drivers/media/test-drivers/visl/visl-debugfs.c @@ -45,7 +45,7 @@ void visl_trace_bitstream(struct visl_ctx *ctx, struct visl_run *run) struct dentry *dentry; char name[32]; - blob = kzalloc(sizeof(*blob), GFP_KERNEL); + blob = kzalloc_obj(*blob, GFP_KERNEL); if (!blob) return; diff --git a/drivers/media/test-drivers/vivid/vivid-core.c b/drivers/media/test-drivers/vivid/vivid-core.c index 9c0b1a32b5c9..5d73701f9080 100644 --- a/drivers/media/test-drivers/vivid/vivid-core.c +++ b/drivers/media/test-drivers/vivid/vivid-core.c @@ -1814,7 +1814,7 @@ static int vivid_create_instance(struct platform_device *pdev, int inst) int i; /* allocate main vivid state structure */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/tuners/e4000.c b/drivers/media/tuners/e4000.c index 549b2009f974..3c2d90fe4349 100644 --- a/drivers/media/tuners/e4000.c +++ b/drivers/media/tuners/e4000.c @@ -621,7 +621,7 @@ static int e4000_probe(struct i2c_client *client) .val_bits = 8, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/tuners/fc0011.c b/drivers/media/tuners/fc0011.c index 3d3b54be2955..e982c1834fe4 100644 --- a/drivers/media/tuners/fc0011.c +++ b/drivers/media/tuners/fc0011.c @@ -485,7 +485,7 @@ struct dvb_frontend *fc0011_attach(struct dvb_frontend *fe, { struct fc0011_priv *priv; - priv = kzalloc(sizeof(struct fc0011_priv), GFP_KERNEL); + priv = kzalloc_obj(struct fc0011_priv, GFP_KERNEL); if (!priv) return NULL; diff --git a/drivers/media/tuners/fc0012.c b/drivers/media/tuners/fc0012.c index 81e65acbdb17..efe0fd2f4673 100644 --- a/drivers/media/tuners/fc0012.c +++ b/drivers/media/tuners/fc0012.c @@ -435,7 +435,7 @@ struct dvb_frontend *fc0012_attach(struct dvb_frontend *fe, if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); - priv = kzalloc(sizeof(struct fc0012_priv), GFP_KERNEL); + priv = kzalloc_obj(struct fc0012_priv, GFP_KERNEL); if (!priv) { ret = -ENOMEM; dev_err(&i2c->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME); diff --git a/drivers/media/tuners/fc0013.c b/drivers/media/tuners/fc0013.c index 90d2ef067594..d0049a302689 100644 --- a/drivers/media/tuners/fc0013.c +++ b/drivers/media/tuners/fc0013.c @@ -526,7 +526,7 @@ struct dvb_frontend *fc0013_attach(struct dvb_frontend *fe, { struct fc0013_priv *priv = NULL; - priv = kzalloc(sizeof(struct fc0013_priv), GFP_KERNEL); + priv = kzalloc_obj(struct fc0013_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/fc2580.c b/drivers/media/tuners/fc2580.c index 046389896dc5..992e716a0703 100644 --- a/drivers/media/tuners/fc2580.c +++ b/drivers/media/tuners/fc2580.c @@ -518,7 +518,7 @@ static int fc2580_probe(struct i2c_client *client) .val_bits = 8, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/tuners/it913x.c b/drivers/media/tuners/it913x.c index 9186174a46fd..a78ce6c76b9c 100644 --- a/drivers/media/tuners/it913x.c +++ b/drivers/media/tuners/it913x.c @@ -385,7 +385,7 @@ static int it913x_probe(struct platform_device *pdev) int ret; char *chip_ver_str; - dev = kzalloc(sizeof(struct it913x_dev), GFP_KERNEL); + dev = kzalloc_obj(struct it913x_dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; dev_err(&pdev->dev, "kzalloc() failed\n"); diff --git a/drivers/media/tuners/m88rs6000t.c b/drivers/media/tuners/m88rs6000t.c index cc57980ed417..16144f4b363e 100644 --- a/drivers/media/tuners/m88rs6000t.c +++ b/drivers/media/tuners/m88rs6000t.c @@ -612,7 +612,7 @@ static int m88rs6000t_probe(struct i2c_client *client) {0x75, 0xFC}, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; dev_err(&client->dev, "kzalloc() failed\n"); diff --git a/drivers/media/tuners/max2165.c b/drivers/media/tuners/max2165.c index 1575ab94e1c8..04c25efb3baa 100644 --- a/drivers/media/tuners/max2165.c +++ b/drivers/media/tuners/max2165.c @@ -394,7 +394,7 @@ struct dvb_frontend *max2165_attach(struct dvb_frontend *fe, i2c ? i2c_adapter_id(i2c) : -1, cfg ? cfg->i2c_address : -1); - priv = kzalloc(sizeof(struct max2165_priv), GFP_KERNEL); + priv = kzalloc_obj(struct max2165_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/mc44s803.c b/drivers/media/tuners/mc44s803.c index ed8bdf7ebd99..fb5dc3bef84f 100644 --- a/drivers/media/tuners/mc44s803.c +++ b/drivers/media/tuners/mc44s803.c @@ -315,7 +315,7 @@ struct dvb_frontend *mc44s803_attach(struct dvb_frontend *fe, reg = 0; - priv = kzalloc(sizeof(struct mc44s803_priv), GFP_KERNEL); + priv = kzalloc_obj(struct mc44s803_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/msi001.c b/drivers/media/tuners/msi001.c index ad6c72c1ed04..071847007e65 100644 --- a/drivers/media/tuners/msi001.c +++ b/drivers/media/tuners/msi001.c @@ -426,7 +426,7 @@ static int msi001_probe(struct spi_device *spi) dev_dbg(&spi->dev, "\n"); - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/tuners/mt2060.c b/drivers/media/tuners/mt2060.c index 4b9dca2f17cc..3ae1c4de9dd3 100644 --- a/drivers/media/tuners/mt2060.c +++ b/drivers/media/tuners/mt2060.c @@ -407,7 +407,7 @@ struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter struct mt2060_priv *priv = NULL; u8 id = 0; - priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL); + priv = kzalloc_obj(struct mt2060_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/mt2063.c b/drivers/media/tuners/mt2063.c index 2c8ce74ddca4..5e226618321a 100644 --- a/drivers/media/tuners/mt2063.c +++ b/drivers/media/tuners/mt2063.c @@ -2212,7 +2212,7 @@ struct dvb_frontend *mt2063_attach(struct dvb_frontend *fe, dprintk(2, "\n"); - state = kzalloc(sizeof(struct mt2063_state), GFP_KERNEL); + state = kzalloc_obj(struct mt2063_state, GFP_KERNEL); if (!state) return NULL; diff --git a/drivers/media/tuners/mt20xx.c b/drivers/media/tuners/mt20xx.c index baf708f42428..5d89b84e4fb9 100644 --- a/drivers/media/tuners/mt20xx.c +++ b/drivers/media/tuners/mt20xx.c @@ -596,7 +596,7 @@ struct dvb_frontend *microtune_attach(struct dvb_frontend *fe, unsigned char buf[21]; int company_code; - priv = kzalloc(sizeof(struct microtune_priv), GFP_KERNEL); + priv = kzalloc_obj(struct microtune_priv, GFP_KERNEL); if (priv == NULL) return NULL; fe->tuner_priv = priv; diff --git a/drivers/media/tuners/mt2131.c b/drivers/media/tuners/mt2131.c index eebc06088341..31ada489ba27 100644 --- a/drivers/media/tuners/mt2131.c +++ b/drivers/media/tuners/mt2131.c @@ -248,7 +248,7 @@ struct dvb_frontend * mt2131_attach(struct dvb_frontend *fe, dprintk(1, "%s()\n", __func__); - priv = kzalloc(sizeof(struct mt2131_priv), GFP_KERNEL); + priv = kzalloc_obj(struct mt2131_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/mt2266.c b/drivers/media/tuners/mt2266.c index 2e92885a6bcb..84bba08ae0a4 100644 --- a/drivers/media/tuners/mt2266.c +++ b/drivers/media/tuners/mt2266.c @@ -313,7 +313,7 @@ struct dvb_frontend * mt2266_attach(struct dvb_frontend *fe, struct i2c_adapter struct mt2266_priv *priv = NULL; u8 id = 0; - priv = kzalloc(sizeof(struct mt2266_priv), GFP_KERNEL); + priv = kzalloc_obj(struct mt2266_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/mxl301rf.c b/drivers/media/tuners/mxl301rf.c index 3b61c3afed18..4cae9d2d37d2 100644 --- a/drivers/media/tuners/mxl301rf.c +++ b/drivers/media/tuners/mxl301rf.c @@ -289,7 +289,7 @@ static int mxl301rf_probe(struct i2c_client *client) struct mxl301rf_config *cfg; struct dvb_frontend *fe; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return -ENOMEM; diff --git a/drivers/media/tuners/mxl5005s.c b/drivers/media/tuners/mxl5005s.c index 0e811c5eae6c..5538066a57ed 100644 --- a/drivers/media/tuners/mxl5005s.c +++ b/drivers/media/tuners/mxl5005s.c @@ -4103,7 +4103,7 @@ struct dvb_frontend *mxl5005s_attach(struct dvb_frontend *fe, struct mxl5005s_state *state = NULL; dprintk(1, "%s()\n", __func__); - state = kzalloc(sizeof(struct mxl5005s_state), GFP_KERNEL); + state = kzalloc_obj(struct mxl5005s_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/tuners/qm1d1b0004.c b/drivers/media/tuners/qm1d1b0004.c index c53aeb558413..dae101ac56f1 100644 --- a/drivers/media/tuners/qm1d1b0004.c +++ b/drivers/media/tuners/qm1d1b0004.c @@ -208,7 +208,7 @@ qm1d1b0004_probe(struct i2c_client *client) fe = cfg->fe; i2c_set_clientdata(client, fe); - fe->tuner_priv = kzalloc(sizeof(struct qm1d1b0004_state), GFP_KERNEL); + fe->tuner_priv = kzalloc_obj(struct qm1d1b0004_state, GFP_KERNEL); if (!fe->tuner_priv) { ret = -ENOMEM; goto err_mem; diff --git a/drivers/media/tuners/qm1d1c0042.c b/drivers/media/tuners/qm1d1c0042.c index c58f5b6526f1..3a9037a2a74b 100644 --- a/drivers/media/tuners/qm1d1c0042.c +++ b/drivers/media/tuners/qm1d1c0042.c @@ -407,7 +407,7 @@ static int qm1d1c0042_probe(struct i2c_client *client) struct qm1d1c0042_config *cfg; struct dvb_frontend *fe; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return -ENOMEM; state->i2c = client; diff --git a/drivers/media/tuners/qt1010.c b/drivers/media/tuners/qt1010.c index 48fc79cd4027..2aee4556ad53 100644 --- a/drivers/media/tuners/qt1010.c +++ b/drivers/media/tuners/qt1010.c @@ -411,7 +411,7 @@ struct dvb_frontend * qt1010_attach(struct dvb_frontend *fe, struct qt1010_priv *priv = NULL; u8 id; - priv = kzalloc(sizeof(struct qt1010_priv), GFP_KERNEL); + priv = kzalloc_obj(struct qt1010_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/si2157.c b/drivers/media/tuners/si2157.c index def06c262ea2..1239206a0ac4 100644 --- a/drivers/media/tuners/si2157.c +++ b/drivers/media/tuners/si2157.c @@ -884,7 +884,7 @@ static int si2157_probe(struct i2c_client *client) struct si2157_cmd cmd; int ret; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; dev_err(&client->dev, "kzalloc() failed\n"); diff --git a/drivers/media/tuners/tda18212.c b/drivers/media/tuners/tda18212.c index 39f2dc9c2845..435189d37655 100644 --- a/drivers/media/tuners/tda18212.c +++ b/drivers/media/tuners/tda18212.c @@ -186,7 +186,7 @@ static int tda18212_probe(struct i2c_client *client) .val_bits = 8, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { ret = -ENOMEM; dev_err(&client->dev, "kzalloc() failed\n"); diff --git a/drivers/media/tuners/tda18218.c b/drivers/media/tuners/tda18218.c index 7d8d84dcb245..f3b54e815657 100644 --- a/drivers/media/tuners/tda18218.c +++ b/drivers/media/tuners/tda18218.c @@ -292,7 +292,7 @@ struct dvb_frontend *tda18218_attach(struct dvb_frontend *fe, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xf6 }; - priv = kzalloc(sizeof(struct tda18218_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tda18218_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/tda18250.c b/drivers/media/tuners/tda18250.c index 68d0275f29e1..4e77ebc10114 100644 --- a/drivers/media/tuners/tda18250.c +++ b/drivers/media/tuners/tda18250.c @@ -769,7 +769,7 @@ static int tda18250_probe(struct i2c_client *client) .volatile_table = &tda18250_volatile_table, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/tuners/tda827x.c b/drivers/media/tuners/tda827x.c index ad68ee6c5ed4..adc00ee687a1 100644 --- a/drivers/media/tuners/tda827x.c +++ b/drivers/media/tuners/tda827x.c @@ -873,7 +873,7 @@ struct dvb_frontend *tda827x_attach(struct dvb_frontend *fe, int addr, struct tda827x_priv *priv = NULL; dprintk("%s:\n", __func__); - priv = kzalloc(sizeof(struct tda827x_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tda827x_priv, GFP_KERNEL); if (priv == NULL) return NULL; diff --git a/drivers/media/tuners/tda8290.c b/drivers/media/tuners/tda8290.c index 98851482c0cc..f15dca8f5b08 100644 --- a/drivers/media/tuners/tda8290.c +++ b/drivers/media/tuners/tda8290.c @@ -734,7 +734,7 @@ struct dvb_frontend *tda829x_attach(struct dvb_frontend *fe, struct tda8290_priv *priv = NULL; char *name; - priv = kzalloc(sizeof(struct tda8290_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tda8290_priv, GFP_KERNEL); if (priv == NULL) return NULL; fe->analog_demod_priv = priv; diff --git a/drivers/media/tuners/tea5761.c b/drivers/media/tuners/tea5761.c index 425e9fd3f3d4..1e3ea4fd7013 100644 --- a/drivers/media/tuners/tea5761.c +++ b/drivers/media/tuners/tea5761.c @@ -315,7 +315,7 @@ struct dvb_frontend *tea5761_attach(struct dvb_frontend *fe, if (tea5761_autodetection(i2c_adap, i2c_addr) != 0) return NULL; - priv = kzalloc(sizeof(struct tea5761_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tea5761_priv, GFP_KERNEL); if (priv == NULL) return NULL; fe->tuner_priv = priv; diff --git a/drivers/media/tuners/tea5767.c b/drivers/media/tuners/tea5767.c index ef4acb1f1bfa..81deab8f2b20 100644 --- a/drivers/media/tuners/tea5767.c +++ b/drivers/media/tuners/tea5767.c @@ -441,7 +441,7 @@ struct dvb_frontend *tea5767_attach(struct dvb_frontend *fe, { struct tea5767_priv *priv = NULL; - priv = kzalloc(sizeof(struct tea5767_priv), GFP_KERNEL); + priv = kzalloc_obj(struct tea5767_priv, GFP_KERNEL); if (priv == NULL) return NULL; fe->tuner_priv = priv; diff --git a/drivers/media/tuners/tua9001.c b/drivers/media/tuners/tua9001.c index 562a7a5c26f5..59bd15ba6280 100644 --- a/drivers/media/tuners/tua9001.c +++ b/drivers/media/tuners/tua9001.c @@ -178,7 +178,7 @@ static int tua9001_probe(struct i2c_client *client) .val_bits = 16, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/tuners/tuner-i2c.h b/drivers/media/tuners/tuner-i2c.h index 724952e001cd..336acbbc622b 100644 --- a/drivers/media/tuners/tuner-i2c.h +++ b/drivers/media/tuners/tuner-i2c.h @@ -132,7 +132,7 @@ static inline int tuner_i2c_xfer_send_recv(struct tuner_i2c_props *props, } \ } \ if (0 == __ret) { \ - state = kzalloc(sizeof(type), GFP_KERNEL); \ + state = kzalloc_obj(type, GFP_KERNEL); \ if (NULL == state) \ goto __fail; \ state->i2c_props.addr = i2caddr; \ diff --git a/drivers/media/tuners/xc2028.c b/drivers/media/tuners/xc2028.c index 807585d2dfde..f0f99142941f 100644 --- a/drivers/media/tuners/xc2028.c +++ b/drivers/media/tuners/xc2028.c @@ -332,7 +332,7 @@ static int load_all_firmwares(struct dvb_frontend *fe, n_array, priv->fname, name, priv->firm_version >> 8, priv->firm_version & 0xff); - priv->firm = kcalloc(n_array, sizeof(*priv->firm), GFP_KERNEL); + priv->firm = kzalloc_objs(*priv->firm, n_array, GFP_KERNEL); if (priv->firm == NULL) { tuner_err("Not enough memory to load firmware file.\n"); rc = -ENOMEM; diff --git a/drivers/media/tuners/xc4000.c b/drivers/media/tuners/xc4000.c index b44c97e4e5ec..674e863839c9 100644 --- a/drivers/media/tuners/xc4000.c +++ b/drivers/media/tuners/xc4000.c @@ -763,7 +763,7 @@ static int xc4000_fwupload(struct dvb_frontend *fe) n_array, fname, name, priv->firm_version >> 8, priv->firm_version & 0xff); - priv->firm = kcalloc(n_array, sizeof(*priv->firm), GFP_KERNEL); + priv->firm = kzalloc_objs(*priv->firm, n_array, GFP_KERNEL); if (priv->firm == NULL) { printk(KERN_ERR "Not enough memory to load firmware file.\n"); rc = -ENOMEM; diff --git a/drivers/media/usb/airspy/airspy.c b/drivers/media/usb/airspy/airspy.c index 08f0920cf6ca..1751a67842bc 100644 --- a/drivers/media/usb/airspy/airspy.c +++ b/drivers/media/usb/airspy/airspy.c @@ -968,7 +968,7 @@ static int airspy_probe(struct usb_interface *intf, buf = NULL; ret = -ENOMEM; - s = kzalloc(sizeof(struct airspy), GFP_KERNEL); + s = kzalloc_obj(struct airspy, GFP_KERNEL); if (s == NULL) { dev_err(&intf->dev, "Could not allocate memory for state\n"); return -ENOMEM; diff --git a/drivers/media/usb/as102/as102_fw.c b/drivers/media/usb/as102/as102_fw.c index 514764247588..6c14b2754b83 100644 --- a/drivers/media/usb/as102/as102_fw.c +++ b/drivers/media/usb/as102/as102_fw.c @@ -96,7 +96,7 @@ static int as102_firmware_upload(struct as10x_bus_adapter_t *bus_adap, int total_read_bytes = 0, errno = 0; unsigned char addr_has_changed = 0; - fw_pkt = kmalloc(sizeof(*fw_pkt), GFP_KERNEL); + fw_pkt = kmalloc_obj(*fw_pkt, GFP_KERNEL); if (!fw_pkt) return -ENOMEM; diff --git a/drivers/media/usb/as102/as102_usb_drv.c b/drivers/media/usb/as102/as102_usb_drv.c index e0ef66a522e2..594dde4578ce 100644 --- a/drivers/media/usb/as102/as102_usb_drv.c +++ b/drivers/media/usb/as102/as102_usb_drv.c @@ -345,7 +345,7 @@ static int as102_usb_probe(struct usb_interface *intf, return -EINVAL; } - as102_dev = kzalloc(sizeof(struct as102_dev_t), GFP_KERNEL); + as102_dev = kzalloc_obj(struct as102_dev_t, GFP_KERNEL); if (as102_dev == NULL) return -ENOMEM; diff --git a/drivers/media/usb/au0828/au0828-core.c b/drivers/media/usb/au0828/au0828-core.c index 1e246b47766d..d99f32d5d06f 100644 --- a/drivers/media/usb/au0828/au0828-core.c +++ b/drivers/media/usb/au0828/au0828-core.c @@ -670,7 +670,7 @@ static int au0828_usb_probe(struct usb_interface *interface, return -ENODEV; } - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) { pr_err("%s() Unable to allocate memory\n", __func__); return -ENOMEM; diff --git a/drivers/media/usb/au0828/au0828-input.c b/drivers/media/usb/au0828/au0828-input.c index 3d3368202cd0..9de5e7fdbbef 100644 --- a/drivers/media/usb/au0828/au0828-input.c +++ b/drivers/media/usb/au0828/au0828-input.c @@ -283,7 +283,7 @@ int au0828_rc_register(struct au0828_dev *dev) if (!i2c_rc_dev_addr) return -ENODEV; - ir = kzalloc(sizeof(*ir), GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); rc = rc_allocate_device(RC_DRIVER_IR_RAW); if (!ir || !rc) goto error; diff --git a/drivers/media/usb/cx231xx/cx231xx-cards.c b/drivers/media/usb/cx231xx/cx231xx-cards.c index 691f073892b3..00029ea23c63 100644 --- a/drivers/media/usb/cx231xx/cx231xx-cards.c +++ b/drivers/media/usb/cx231xx/cx231xx-cards.c @@ -1295,7 +1295,7 @@ void cx231xx_card_setup(struct cx231xx *dev) u8 eeprom[256]; struct i2c_client client; }; - struct eeprom *e = kzalloc(sizeof(*e), GFP_KERNEL); + struct eeprom *e = kzalloc_obj(*e, GFP_KERNEL); if (e == NULL) { dev_err(dev->dev, @@ -1381,7 +1381,7 @@ static int cx231xx_media_device_init(struct cx231xx *dev, #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + mdev = kzalloc_obj(*mdev, GFP_KERNEL); if (!mdev) return -ENOMEM; diff --git a/drivers/media/usb/cx231xx/cx231xx-dvb.c b/drivers/media/usb/cx231xx/cx231xx-dvb.c index 0037b4b1381e..913d53abd0e4 100644 --- a/drivers/media/usb/cx231xx/cx231xx-dvb.c +++ b/drivers/media/usb/cx231xx/cx231xx-dvb.c @@ -627,7 +627,7 @@ static int dvb_init(struct cx231xx *dev) return 0; } - dvb = kzalloc(sizeof(struct cx231xx_dvb), GFP_KERNEL); + dvb = kzalloc_obj(struct cx231xx_dvb, GFP_KERNEL); if (dvb == NULL) { dev_info(dev->dev, diff --git a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c index f1c79f351ec8..acbc951dbdc0 100644 --- a/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c +++ b/drivers/media/usb/dvb-usb-v2/dvb_usb_core.c @@ -392,7 +392,7 @@ static int dvb_usbv2_media_device_init(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap_to_d(adap); struct usb_device *udev = d->udev; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + mdev = kzalloc_obj(*mdev, GFP_KERNEL); if (!mdev) return -ENOMEM; @@ -904,7 +904,7 @@ int dvb_usbv2_probe(struct usb_interface *intf, goto err; } - d = kzalloc(sizeof(struct dvb_usb_device), GFP_KERNEL); + d = kzalloc_obj(struct dvb_usb_device, GFP_KERNEL); if (!d) { dev_err(&udev->dev, "%s: kzalloc() failed\n", KBUILD_MODNAME); ret = -ENOMEM; diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c index a6ad5f477520..4811f4d1ac87 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-demod.c @@ -577,7 +577,7 @@ struct dvb_frontend *mxl111sf_demod_attach(struct mxl111sf_state *mxl_state, mxl_dbg("()"); - state = kzalloc(sizeof(struct mxl111sf_demod_state), GFP_KERNEL); + state = kzalloc_obj(struct mxl111sf_demod_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c index 6686f75cbd94..0cc78fd8e916 100644 --- a/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c +++ b/drivers/media/usb/dvb-usb-v2/mxl111sf-tuner.c @@ -482,7 +482,7 @@ struct dvb_frontend *mxl111sf_tuner_attach(struct dvb_frontend *fe, mxl_dbg("()"); - state = kzalloc(sizeof(struct mxl111sf_tuner_state), GFP_KERNEL); + state = kzalloc_obj(struct mxl111sf_tuner_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/usb/dvb-usb/af9005-fe.c b/drivers/media/usb/dvb-usb/af9005-fe.c index 404e56b32145..b6fb72c97aef 100644 --- a/drivers/media/usb/dvb-usb/af9005-fe.c +++ b/drivers/media/usb/dvb-usb/af9005-fe.c @@ -1423,7 +1423,7 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d) struct af9005_fe_state *state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct af9005_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct af9005_fe_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/usb/dvb-usb/cinergyT2-fe.c b/drivers/media/usb/dvb-usb/cinergyT2-fe.c index efb207c23a64..84f167a463ce 100644 --- a/drivers/media/usb/dvb-usb/cinergyT2-fe.c +++ b/drivers/media/usb/dvb-usb/cinergyT2-fe.c @@ -268,8 +268,8 @@ static const struct dvb_frontend_ops cinergyt2_fe_ops; struct dvb_frontend *cinergyt2_fe_attach(struct dvb_usb_device *d) { - struct cinergyt2_fe_state *s = kzalloc(sizeof( - struct cinergyt2_fe_state), GFP_KERNEL); + struct cinergyt2_fe_state *s = kzalloc_obj(struct cinergyt2_fe_state, + GFP_KERNEL); if (s == NULL) return NULL; diff --git a/drivers/media/usb/dvb-usb/dtt200u-fe.c b/drivers/media/usb/dvb-usb/dtt200u-fe.c index 586afe22d817..30d2e6d46b5b 100644 --- a/drivers/media/usb/dvb-usb/dtt200u-fe.c +++ b/drivers/media/usb/dvb-usb/dtt200u-fe.c @@ -206,7 +206,7 @@ struct dvb_frontend* dtt200u_fe_attach(struct dvb_usb_device *d) struct dtt200u_fe_state* state = NULL; /* allocate memory for the internal state */ - state = kzalloc(sizeof(struct dtt200u_fe_state), GFP_KERNEL); + state = kzalloc_obj(struct dtt200u_fe_state, GFP_KERNEL); if (state == NULL) goto error; diff --git a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c index 0a7f8ba90992..94e1e7ce278d 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-dvb.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-dvb.c @@ -103,7 +103,7 @@ static int dvb_usb_media_device_init(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap->dev; struct usb_device *udev = d->udev; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + mdev = kzalloc_obj(*mdev, GFP_KERNEL); if (!mdev) return -ENOMEM; diff --git a/drivers/media/usb/dvb-usb/dvb-usb-init.c b/drivers/media/usb/dvb-usb/dvb-usb-init.c index fbf58012becd..656401276d09 100644 --- a/drivers/media/usb/dvb-usb/dvb-usb-init.c +++ b/drivers/media/usb/dvb-usb/dvb-usb-init.c @@ -278,7 +278,7 @@ int dvb_usb_device_init(struct usb_interface *intf, if (du != NULL) *du = NULL; - d = kzalloc(sizeof(*d), GFP_KERNEL); + d = kzalloc_obj(*d, GFP_KERNEL); if (!d) { err("no memory for 'struct dvb_usb_device'"); return -ENOMEM; diff --git a/drivers/media/usb/dvb-usb/vp702x-fe.c b/drivers/media/usb/dvb-usb/vp702x-fe.c index c1e7931900ee..0f9bd7abbcec 100644 --- a/drivers/media/usb/dvb-usb/vp702x-fe.c +++ b/drivers/media/usb/dvb-usb/vp702x-fe.c @@ -323,7 +323,8 @@ static const struct dvb_frontend_ops vp702x_fe_ops; struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d) { - struct vp702x_fe_state *s = kzalloc(sizeof(struct vp702x_fe_state), GFP_KERNEL); + struct vp702x_fe_state *s = kzalloc_obj(struct vp702x_fe_state, + GFP_KERNEL); if (s == NULL) goto error; diff --git a/drivers/media/usb/dvb-usb/vp7045-fe.c b/drivers/media/usb/dvb-usb/vp7045-fe.c index e99740ec2650..a6555fc0b79a 100644 --- a/drivers/media/usb/dvb-usb/vp7045-fe.c +++ b/drivers/media/usb/dvb-usb/vp7045-fe.c @@ -140,7 +140,8 @@ static const struct dvb_frontend_ops vp7045_fe_ops; struct dvb_frontend * vp7045_fe_attach(struct dvb_usb_device *d) { - struct vp7045_fe_state *s = kzalloc(sizeof(struct vp7045_fe_state), GFP_KERNEL); + struct vp7045_fe_state *s = kzalloc_obj(struct vp7045_fe_state, + GFP_KERNEL); if (s == NULL) goto error; diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c index ce1b0d9e0741..ca8432d47301 100644 --- a/drivers/media/usb/em28xx/em28xx-audio.c +++ b/drivers/media/usb/em28xx/em28xx-audio.c @@ -750,7 +750,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev) if (!dev->adev.transfer_buffer) return -ENOMEM; - dev->adev.urb = kcalloc(num_urb, sizeof(*dev->adev.urb), GFP_KERNEL); + dev->adev.urb = kzalloc_objs(*dev->adev.urb, num_urb, GFP_KERNEL); if (!dev->adev.urb) { kfree(dev->adev.transfer_buffer); return -ENOMEM; diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c index a51cbcf429e1..2fa43caaa968 100644 --- a/drivers/media/usb/em28xx/em28xx-cards.c +++ b/drivers/media/usb/em28xx/em28xx-cards.c @@ -3488,7 +3488,7 @@ static int em28xx_media_device_init(struct em28xx *dev, #ifdef CONFIG_MEDIA_CONTROLLER struct media_device *mdev; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + mdev = kzalloc_obj(*mdev, GFP_KERNEL); if (!mdev) return -ENOMEM; @@ -3905,7 +3905,7 @@ static int em28xx_usb_probe(struct usb_interface *intf, } /* allocate memory for our device state and initialize it */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { retval = -ENOMEM; goto err; diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c index b94f5c70ab75..c6151d2a21a6 100644 --- a/drivers/media/usb/em28xx/em28xx-dvb.c +++ b/drivers/media/usb/em28xx/em28xx-dvb.c @@ -1500,7 +1500,7 @@ static int em28xx_dvb_init(struct em28xx *dev) dev_info(&dev->intf->dev, "Binding DVB extension\n"); - dvb = kzalloc(sizeof(*dvb), GFP_KERNEL); + dvb = kzalloc_obj(*dvb, GFP_KERNEL); if (!dvb) return -ENOMEM; diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c index 5f3b00869bdb..f8de173affd5 100644 --- a/drivers/media/usb/em28xx/em28xx-input.c +++ b/drivers/media/usb/em28xx/em28xx-input.c @@ -724,7 +724,7 @@ static int em28xx_ir_init(struct em28xx *dev) dev_info(&dev->intf->dev, "Registering input extension\n"); - ir = kzalloc(sizeof(*ir), GFP_KERNEL); + ir = kzalloc_obj(*ir, GFP_KERNEL); if (!ir) goto ref_put; rc = rc_allocate_device(RC_DRIVER_SCANCODE); @@ -765,7 +765,7 @@ static int em28xx_ir_init(struct em28xx *dev) goto error; } - ir->i2c_client = kzalloc(sizeof(*ir->i2c_client), GFP_KERNEL); + ir->i2c_client = kzalloc_obj(*ir->i2c_client, GFP_KERNEL); if (!ir->i2c_client) goto error; ir->i2c_client->adapter = &ir->dev->i2c_adap[dev->def_i2c_bus]; diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c index 2dfa3242a7ab..ca88b6b13724 100644 --- a/drivers/media/usb/em28xx/em28xx-video.c +++ b/drivers/media/usb/em28xx/em28xx-video.c @@ -2529,7 +2529,7 @@ static int em28xx_v4l2_init(struct em28xx *dev) mutex_lock(&dev->lock); - v4l2 = kzalloc(sizeof(*v4l2), GFP_KERNEL); + v4l2 = kzalloc_obj(*v4l2, GFP_KERNEL); if (!v4l2) { mutex_unlock(&dev->lock); return -ENOMEM; diff --git a/drivers/media/usb/go7007/go7007-driver.c b/drivers/media/usb/go7007/go7007-driver.c index 468406302cd5..77f4d9a249ea 100644 --- a/drivers/media/usb/go7007/go7007-driver.c +++ b/drivers/media/usb/go7007/go7007-driver.c @@ -694,7 +694,7 @@ struct go7007 *go7007_alloc(const struct go7007_board_info *board, { struct go7007 *go; - go = kzalloc(sizeof(struct go7007), GFP_KERNEL); + go = kzalloc_obj(struct go7007, GFP_KERNEL); if (go == NULL) return NULL; go->dev = dev; diff --git a/drivers/media/usb/go7007/go7007-usb.c b/drivers/media/usb/go7007/go7007-usb.c index 334cdde81a5c..8a42aaac9cba 100644 --- a/drivers/media/usb/go7007/go7007-usb.c +++ b/drivers/media/usb/go7007/go7007-usb.c @@ -1115,7 +1115,7 @@ static int go7007_usb_probe(struct usb_interface *intf, if (go == NULL) return -ENOMEM; - usb = kzalloc(sizeof(struct go7007_usb), GFP_KERNEL); + usb = kzalloc_obj(struct go7007_usb, GFP_KERNEL); if (usb == NULL) { kfree(go); return -ENOMEM; diff --git a/drivers/media/usb/go7007/s2250-board.c b/drivers/media/usb/go7007/s2250-board.c index a155b987282f..23f577b0cfbf 100644 --- a/drivers/media/usb/go7007/s2250-board.c +++ b/drivers/media/usb/go7007/s2250-board.c @@ -509,7 +509,7 @@ static int s2250_probe(struct i2c_client *client) if (IS_ERR(audio)) return PTR_ERR(audio); - state = kzalloc(sizeof(struct s2250), GFP_KERNEL); + state = kzalloc_obj(struct s2250, GFP_KERNEL); if (state == NULL) { i2c_unregister_device(audio); return -ENOMEM; diff --git a/drivers/media/usb/go7007/snd-go7007.c b/drivers/media/usb/go7007/snd-go7007.c index 9a6bd87fce03..c294c9486611 100644 --- a/drivers/media/usb/go7007/snd-go7007.c +++ b/drivers/media/usb/go7007/snd-go7007.c @@ -207,7 +207,7 @@ int go7007_snd_init(struct go7007 *go) dev++; return -ENOENT; } - gosnd = kmalloc(sizeof(struct go7007_snd), GFP_KERNEL); + gosnd = kmalloc_obj(struct go7007_snd, GFP_KERNEL); if (gosnd == NULL) return -ENOMEM; spin_lock_init(&gosnd->lock); diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c index 303b055fefea..ecb73b0b186b 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_hdcs.c @@ -368,7 +368,7 @@ static int hdcs_probe_1x00(struct sd *sd) sd->gspca_dev.cam.cam_mode = hdcs1x00_mode; sd->gspca_dev.cam.nmodes = ARRAY_SIZE(hdcs1x00_mode); - hdcs = kmalloc(sizeof(struct hdcs), GFP_KERNEL); + hdcs = kmalloc_obj(struct hdcs, GFP_KERNEL); if (!hdcs) return -ENOMEM; @@ -425,7 +425,7 @@ static int hdcs_probe_1020(struct sd *sd) sd->gspca_dev.cam.cam_mode = hdcs1020_mode; sd->gspca_dev.cam.nmodes = ARRAY_SIZE(hdcs1020_mode); - hdcs = kmalloc(sizeof(struct hdcs), GFP_KERNEL); + hdcs = kmalloc_obj(struct hdcs, GFP_KERNEL); if (!hdcs) return -ENOMEM; diff --git a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c index ae382b3b5f7f..984e6283ce83 100644 --- a/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c +++ b/drivers/media/usb/gspca/stv06xx/stv06xx_pb0100.c @@ -126,7 +126,7 @@ static int pb0100_init_controls(struct sd *sd) .def = 1, }; - ctrls = kzalloc(sizeof(*ctrls), GFP_KERNEL); + ctrls = kzalloc_obj(*ctrls, GFP_KERNEL); if (!ctrls) return -ENOMEM; diff --git a/drivers/media/usb/hackrf/hackrf.c b/drivers/media/usb/hackrf/hackrf.c index 0b50de8775a3..599ebcad2bcc 100644 --- a/drivers/media/usb/hackrf/hackrf.c +++ b/drivers/media/usb/hackrf/hackrf.c @@ -1348,7 +1348,7 @@ static int hackrf_probe(struct usb_interface *intf, int ret; u8 u8tmp, buf[BUF_SIZE]; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/usb/hdpvr/hdpvr-core.c b/drivers/media/usb/hdpvr/hdpvr-core.c index 52e05a69c46e..eba330e00fb7 100644 --- a/drivers/media/usb/hdpvr/hdpvr-core.c +++ b/drivers/media/usb/hdpvr/hdpvr-core.c @@ -276,7 +276,7 @@ static int hdpvr_probe(struct usb_interface *interface, int retval = -ENOMEM; /* allocate memory for our device state and initialize it */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { dev_err(&interface->dev, "Out of memory\n"); goto error; diff --git a/drivers/media/usb/hdpvr/hdpvr-video.c b/drivers/media/usb/hdpvr/hdpvr-video.c index 8c7ae362d992..54c0484a14d8 100644 --- a/drivers/media/usb/hdpvr/hdpvr-video.c +++ b/drivers/media/usb/hdpvr/hdpvr-video.c @@ -147,7 +147,7 @@ int hdpvr_alloc_buffers(struct hdpvr_device *dev, uint count) for (i = 0; i < count; i++) { - buf = kzalloc(sizeof(struct hdpvr_buffer), GFP_KERNEL); + buf = kzalloc_obj(struct hdpvr_buffer, GFP_KERNEL); if (!buf) { v4l2_err(&dev->v4l2_dev, "cannot allocate buffer\n"); goto exit; @@ -379,7 +379,7 @@ static int hdpvr_stop_streaming(struct hdpvr_device *dev) static int hdpvr_open(struct file *file) { - struct hdpvr_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); + struct hdpvr_fh *fh = kzalloc_obj(*fh, GFP_KERNEL); if (fh == NULL) return -ENOMEM; diff --git a/drivers/media/usb/msi2500/msi2500.c b/drivers/media/usb/msi2500/msi2500.c index 33099f39146a..330955ddb703 100644 --- a/drivers/media/usb/msi2500/msi2500.c +++ b/drivers/media/usb/msi2500/msi2500.c @@ -1170,7 +1170,7 @@ static int msi2500_probe(struct usb_interface *intf, .max_speed_hz = 12000000, }; - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (!dev) { ret = -ENOMEM; goto err; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-context.c b/drivers/media/usb/pvrusb2/pvrusb2-context.c index 73c95ba2328a..ca970f7f4bc0 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-context.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-context.c @@ -204,7 +204,7 @@ struct pvr2_context *pvr2_context_create( void (*setup_func)(struct pvr2_context *)) { struct pvr2_context *mp = NULL; - mp = kzalloc(sizeof(*mp),GFP_KERNEL); + mp = kzalloc_obj(*mp, GFP_KERNEL); if (!mp) goto done; pvr2_trace(PVR2_TRACE_CTXT,"pvr2_context %p (create)",mp); mp->setup_func = setup_func; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c index 3610139fb9ad..064c11b7effe 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-dvb.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-dvb.c @@ -449,7 +449,7 @@ struct pvr2_dvb_adapter *pvr2_dvb_create(struct pvr2_context *pvr) the DVB side of the driver either. For now. */ return NULL; } - adap = kzalloc(sizeof(*adap), GFP_KERNEL); + adap = kzalloc_obj(*adap, GFP_KERNEL); if (!adap) return adap; pvr2_channel_init(&adap->channel, pvr); adap->channel.check_func = pvr2_dvb_internal_check; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c index 5807734ae26c..fe988c6b693f 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-hdw.c @@ -2367,7 +2367,7 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, goto fail; } - hdw = kzalloc(sizeof(*hdw),GFP_KERNEL); + hdw = kzalloc_obj(*hdw, GFP_KERNEL); pvr2_trace(PVR2_TRACE_INIT,"pvr2_hdw_create: hdw=%p, type \"%s\"", hdw,hdw_desc->description); pvr2_trace(PVR2_TRACE_INFO, "Hardware description: %s", @@ -2424,8 +2424,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, hdw->control_cnt = CTRLDEF_COUNT; hdw->control_cnt += MPEGDEF_COUNT; - hdw->controls = kcalloc(hdw->control_cnt, sizeof(struct pvr2_ctrl), - GFP_KERNEL); + hdw->controls = kzalloc_objs(struct pvr2_ctrl, hdw->control_cnt, + GFP_KERNEL); if (!hdw->controls) goto fail; hdw->hdw_desc = hdw_desc; hdw->ir_scheme_active = hdw->hdw_desc->ir_scheme; @@ -2450,9 +2450,8 @@ struct pvr2_hdw *pvr2_hdw_create(struct usb_interface *intf, } /* Define and configure additional controls from cx2341x module. */ - hdw->mpeg_ctrl_info = kcalloc(MPEGDEF_COUNT, - sizeof(*(hdw->mpeg_ctrl_info)), - GFP_KERNEL); + hdw->mpeg_ctrl_info = kzalloc_objs(*(hdw->mpeg_ctrl_info), + MPEGDEF_COUNT, GFP_KERNEL); if (!hdw->mpeg_ctrl_info) goto fail; for (idx = 0; idx < MPEGDEF_COUNT; idx++) { cptr = hdw->controls + idx + CTRLDEF_COUNT; diff --git a/drivers/media/usb/pvrusb2/pvrusb2-io.c b/drivers/media/usb/pvrusb2/pvrusb2-io.c index 28ffe7981f8c..1341967ac666 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-io.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-io.c @@ -299,7 +299,7 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp, unsigned int cnt) if (scnt > sp->buffer_slot_count) { struct pvr2_buffer **nb; - nb = kmalloc_array(scnt, sizeof(*nb), GFP_KERNEL); + nb = kmalloc_objs(*nb, scnt, GFP_KERNEL); if (!nb) return -ENOMEM; if (sp->buffer_slot_count) { memcpy(nb, sp->buffers, @@ -311,7 +311,7 @@ static int pvr2_stream_buffer_count(struct pvr2_stream *sp, unsigned int cnt) } while (sp->buffer_total_count < cnt) { struct pvr2_buffer *bp; - bp = kmalloc(sizeof(*bp), GFP_KERNEL); + bp = kmalloc_obj(*bp, GFP_KERNEL); if (!bp) return -ENOMEM; ret = pvr2_buffer_init(bp, sp, sp->buffer_total_count); if (ret) { @@ -460,7 +460,7 @@ static void buffer_complete(struct urb *urb) struct pvr2_stream *pvr2_stream_create(void) { struct pvr2_stream *sp; - sp = kzalloc(sizeof(*sp), GFP_KERNEL); + sp = kzalloc_obj(*sp, GFP_KERNEL); if (!sp) return sp; pvr2_trace(PVR2_TRACE_INIT, "pvr2_stream_create: sp=%p", sp); pvr2_stream_init(sp); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c index 46f8013849b9..d397231f153d 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-ioread.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-ioread.c @@ -73,7 +73,7 @@ static void pvr2_ioread_done(struct pvr2_ioread *cp) struct pvr2_ioread *pvr2_ioread_create(void) { struct pvr2_ioread *cp; - cp = kzalloc(sizeof(*cp),GFP_KERNEL); + cp = kzalloc_obj(*cp, GFP_KERNEL); if (!cp) return NULL; pvr2_trace(PVR2_TRACE_STRUCT,"pvr2_ioread_create id=%p",cp); if (pvr2_ioread_init(cp) < 0) { diff --git a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c index 3077399901aa..f2cb644ca3d7 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-sysfs.c @@ -289,7 +289,7 @@ static void pvr2_sysfs_add_control(struct pvr2_sysfs *sfp,int ctl_id) cptr = pvr2_hdw_get_ctrl_by_index(sfp->channel.hdw,ctl_id); if (!cptr) return; - cip = kzalloc(sizeof(*cip),GFP_KERNEL); + cip = kzalloc_obj(*cip, GFP_KERNEL); if (!cip) return; pvr2_sysfs_trace("Creating pvr2_sysfs_ctl_item id=%p",cip); @@ -411,7 +411,7 @@ static void pvr2_sysfs_add_debugifc(struct pvr2_sysfs *sfp) struct pvr2_sysfs_debugifc *dip; int ret; - dip = kzalloc(sizeof(*dip),GFP_KERNEL); + dip = kzalloc_obj(*dip, GFP_KERNEL); if (!dip) return; sysfs_attr_init(&dip->attr_debugcmd.attr); dip->attr_debugcmd.attr.name = "debugcmd"; @@ -615,7 +615,7 @@ static void class_dev_create(struct pvr2_sysfs *sfp) usb_dev = pvr2_hdw_get_dev(sfp->channel.hdw); if (!usb_dev) return; - class_dev = kzalloc(sizeof(*class_dev),GFP_KERNEL); + class_dev = kzalloc_obj(*class_dev, GFP_KERNEL); if (!class_dev) return; pvr2_sysfs_trace("Creating class_dev id=%p",class_dev); @@ -748,7 +748,7 @@ static void pvr2_sysfs_internal_check(struct pvr2_channel *chp) void pvr2_sysfs_create(struct pvr2_context *mp) { struct pvr2_sysfs *sfp; - sfp = kzalloc(sizeof(*sfp),GFP_KERNEL); + sfp = kzalloc_obj(*sfp, GFP_KERNEL); if (!sfp) return; pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_sysfs id=%p",sfp); diff --git a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c index f9535a484738..6fd0bfb5f699 100644 --- a/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c +++ b/drivers/media/usb/pvrusb2/pvrusb2-v4l2.c @@ -944,7 +944,7 @@ static int pvr2_v4l2_open(struct file *file) return -EIO; } - fhp = kzalloc(sizeof(*fhp),GFP_KERNEL); + fhp = kzalloc_obj(*fhp, GFP_KERNEL); if (!fhp) { return -ENOMEM; } @@ -1236,7 +1236,7 @@ struct pvr2_v4l2 *pvr2_v4l2_create(struct pvr2_context *mnp) { struct pvr2_v4l2 *vp; - vp = kzalloc(sizeof(*vp),GFP_KERNEL); + vp = kzalloc_obj(*vp, GFP_KERNEL); if (!vp) return vp; pvr2_channel_init(&vp->channel,mnp); pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_v4l2 id=%p",vp); @@ -1244,12 +1244,12 @@ struct pvr2_v4l2 *pvr2_v4l2_create(struct pvr2_context *mnp) vp->channel.check_func = pvr2_v4l2_internal_check; /* register streams */ - vp->dev_video = kzalloc(sizeof(*vp->dev_video),GFP_KERNEL); + vp->dev_video = kzalloc_obj(*vp->dev_video, GFP_KERNEL); if (!vp->dev_video) goto fail; pvr2_v4l2_dev_init(vp->dev_video,vp,VFL_TYPE_VIDEO); if (pvr2_hdw_get_input_available(vp->channel.mc_head->hdw) & (1 << PVR2_CVAL_INPUT_RADIO)) { - vp->dev_radio = kzalloc(sizeof(*vp->dev_radio),GFP_KERNEL); + vp->dev_radio = kzalloc_obj(*vp->dev_radio, GFP_KERNEL); if (!vp->dev_radio) goto fail; pvr2_v4l2_dev_init(vp->dev_radio,vp,VFL_TYPE_RADIO); } diff --git a/drivers/media/usb/pwc/pwc-if.c b/drivers/media/usb/pwc/pwc-if.c index c6e5d031f068..b57502237f3a 100644 --- a/drivers/media/usb/pwc/pwc-if.c +++ b/drivers/media/usb/pwc/pwc-if.c @@ -1026,7 +1026,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id PWC_WARNING("Warning: more than 1 configuration available.\n"); /* Allocate structure, initialize pointers, mutexes, etc. and link it to the usb_device */ - pdev = kzalloc(sizeof(struct pwc_device), GFP_KERNEL); + pdev = kzalloc_obj(struct pwc_device, GFP_KERNEL); if (pdev == NULL) { PWC_ERROR("Oops, could not allocate memory for pwc_device.\n"); return -ENOMEM; diff --git a/drivers/media/usb/s2255/s2255drv.c b/drivers/media/usb/s2255/s2255drv.c index 8332f2c5aed7..189a356eaf34 100644 --- a/drivers/media/usb/s2255/s2255drv.c +++ b/drivers/media/usb/s2255/s2255drv.c @@ -2207,7 +2207,7 @@ static int s2255_probe(struct usb_interface *interface, int fw_size; /* allocate memory for our device state and initialize it to zero */ - dev = kzalloc(sizeof(struct s2255_dev), GFP_KERNEL); + dev = kzalloc_obj(struct s2255_dev, GFP_KERNEL); if (dev == NULL) { s2255_dev_err(&interface->dev, "out of memory\n"); return -ENOMEM; @@ -2221,7 +2221,7 @@ static int s2255_probe(struct usb_interface *interface, refcount_set(&dev->num_channels, 0); dev->pid = id->idProduct; - dev->fw_data = kzalloc(sizeof(struct s2255_fw), GFP_KERNEL); + dev->fw_data = kzalloc_obj(struct s2255_fw, GFP_KERNEL); if (!dev->fw_data) goto errorFWDATA1; mutex_init(&dev->lock); diff --git a/drivers/media/usb/siano/smsusb.c b/drivers/media/usb/siano/smsusb.c index 2c8179a84991..4d9cb4184ca2 100644 --- a/drivers/media/usb/siano/smsusb.c +++ b/drivers/media/usb/siano/smsusb.c @@ -367,7 +367,7 @@ static void *siano_media_device_register(struct smsusb_device_t *dev, struct sms_board *board = sms_get_board(board_id); int ret; - mdev = kzalloc(sizeof(*mdev), GFP_KERNEL); + mdev = kzalloc_obj(*mdev, GFP_KERNEL); if (!mdev) return NULL; @@ -397,7 +397,7 @@ static int smsusb_init_device(struct usb_interface *intf, int board_id) int align = 0; /* create device object */ - dev = kzalloc(sizeof(struct smsusb_device_t), GFP_KERNEL); + dev = kzalloc_obj(struct smsusb_device_t, GFP_KERNEL); if (!dev) return -ENOMEM; diff --git a/drivers/media/usb/stk1160/stk1160-core.c b/drivers/media/usb/stk1160/stk1160-core.c index 25d725c2ab3c..ec4a9e2f42ab 100644 --- a/drivers/media/usb/stk1160/stk1160-core.c +++ b/drivers/media/usb/stk1160/stk1160-core.c @@ -295,7 +295,7 @@ static int stk1160_probe(struct usb_interface *interface, return rc; } - dev = kzalloc(sizeof(struct stk1160), GFP_KERNEL); + dev = kzalloc_obj(struct stk1160, GFP_KERNEL); if (dev == NULL) { kfree(alt_max_pkt_size); return -ENOMEM; diff --git a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c index 9e016b71aa91..9cd0ea41300c 100644 --- a/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/usb/ttusb-budget/dvb-ttusb-budget.c @@ -1606,7 +1606,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i if (intf->altsetting->desc.bInterfaceNumber != 1) return -ENODEV; - if (!(ttusb = kzalloc(sizeof(struct ttusb), GFP_KERNEL))) + if (!(ttusb = kzalloc_obj(struct ttusb, GFP_KERNEL))) return -ENOMEM; ttusb->dev = udev; diff --git a/drivers/media/usb/ttusb-dec/ttusb_dec.c b/drivers/media/usb/ttusb-dec/ttusb_dec.c index b4575fe89c95..24ba5c1c48d2 100644 --- a/drivers/media/usb/ttusb-dec/ttusb_dec.c +++ b/drivers/media/usb/ttusb-dec/ttusb_dec.c @@ -809,8 +809,7 @@ static void ttusb_dec_process_urb(struct urb *urb) b = urb->transfer_buffer + d->offset; length = d->actual_length; - if ((frame = kmalloc(sizeof(struct urb_frame), - GFP_ATOMIC))) { + if ((frame = kmalloc_obj(struct urb_frame, GFP_ATOMIC))) { unsigned long flags; memcpy(frame->data, b, length); @@ -1061,8 +1060,7 @@ static int ttusb_dec_start_sec_feed(struct dvb_demux_feed *dvbdmxfeed) if (!result) { if (c_length == 2) { - if (!(finfo = kmalloc(sizeof(struct filter_info), - GFP_ATOMIC))) + if (!(finfo = kmalloc_obj(struct filter_info, GFP_ATOMIC))) return -ENOMEM; finfo->stream_id = c[1]; @@ -1644,7 +1642,7 @@ static int ttusb_dec_probe(struct usb_interface *intf, udev = interface_to_usbdev(intf); - if (!(dec = kzalloc(sizeof(struct ttusb_dec), GFP_KERNEL))) { + if (!(dec = kzalloc_obj(struct ttusb_dec, GFP_KERNEL))) { printk("%s: couldn't allocate memory.\n", __func__); return -ENOMEM; } diff --git a/drivers/media/usb/ttusb-dec/ttusbdecfe.c b/drivers/media/usb/ttusb-dec/ttusbdecfe.c index dff6bf532ce3..df4ade291db4 100644 --- a/drivers/media/usb/ttusb-dec/ttusbdecfe.c +++ b/drivers/media/usb/ttusb-dec/ttusbdecfe.c @@ -198,7 +198,7 @@ struct dvb_frontend* ttusbdecfe_dvbt_attach(const struct ttusbdecfe_config* conf struct ttusbdecfe_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); + state = kmalloc_obj(struct ttusbdecfe_state, GFP_KERNEL); if (state == NULL) return NULL; @@ -218,7 +218,7 @@ struct dvb_frontend* ttusbdecfe_dvbs_attach(const struct ttusbdecfe_config* conf struct ttusbdecfe_state* state = NULL; /* allocate memory for the internal state */ - state = kmalloc(sizeof(struct ttusbdecfe_state), GFP_KERNEL); + state = kmalloc_obj(struct ttusbdecfe_state, GFP_KERNEL); if (state == NULL) return NULL; diff --git a/drivers/media/usb/usbtv/usbtv-core.c b/drivers/media/usb/usbtv/usbtv-core.c index 1f7620cd2996..12ed28253d0c 100644 --- a/drivers/media/usb/usbtv/usbtv-core.c +++ b/drivers/media/usb/usbtv/usbtv-core.c @@ -87,7 +87,7 @@ static int usbtv_probe(struct usb_interface *intf, size = size * usb_endpoint_maxp_mult(&ep->desc); /* Device structure */ - usbtv = kzalloc(sizeof(struct usbtv), GFP_KERNEL); + usbtv = kzalloc_obj(struct usbtv, GFP_KERNEL); if (usbtv == NULL) return -ENOMEM; usbtv->dev = dev; diff --git a/drivers/media/usb/uvc/uvc_ctrl.c b/drivers/media/usb/uvc/uvc_ctrl.c index f0f6f8454d9c..2c511d1d9bf9 100644 --- a/drivers/media/usb/uvc/uvc_ctrl.c +++ b/drivers/media/usb/uvc/uvc_ctrl.c @@ -600,7 +600,7 @@ static const struct uvc_control_mapping *uvc_ctrl_filter_plf_mapping( u8 init_val; int ret; - buf = kmalloc(sizeof(*buf), GFP_KERNEL); + buf = kmalloc_obj(*buf, GFP_KERNEL); if (!buf) return NULL; @@ -3339,8 +3339,7 @@ static int uvc_ctrl_init_chain(struct uvc_video_chain *chain) if (ncontrols == 0) continue; - entity->controls = kcalloc(ncontrols, sizeof(*ctrl), - GFP_KERNEL); + entity->controls = kzalloc_objs(*ctrl, ncontrols, GFP_KERNEL); if (entity->controls == NULL) return -ENOMEM; entity->ncontrols = ncontrols; diff --git a/drivers/media/usb/uvc/uvc_debugfs.c b/drivers/media/usb/uvc/uvc_debugfs.c index 14fa41cb8148..1ea4a4e82662 100644 --- a/drivers/media/usb/uvc/uvc_debugfs.c +++ b/drivers/media/usb/uvc/uvc_debugfs.c @@ -29,7 +29,7 @@ static int uvc_debugfs_stats_open(struct inode *inode, struct file *file) struct uvc_streaming *stream = inode->i_private; struct uvc_debugfs_buffer *buf; - buf = kmalloc(sizeof(*buf), GFP_KERNEL); + buf = kmalloc_obj(*buf, GFP_KERNEL); if (buf == NULL) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c index aa3e8d295e0f..05c5f70c0a93 100644 --- a/drivers/media/usb/uvc/uvc_driver.c +++ b/drivers/media/usb/uvc/uvc_driver.c @@ -200,7 +200,7 @@ static struct uvc_streaming *uvc_stream_new(struct uvc_device *dev, { struct uvc_streaming *stream; - stream = kzalloc(sizeof(*stream), GFP_KERNEL); + stream = kzalloc_obj(*stream, GFP_KERNEL); if (stream == NULL) return NULL; @@ -1761,7 +1761,7 @@ static struct uvc_video_chain *uvc_alloc_chain(struct uvc_device *dev) { struct uvc_video_chain *chain; - chain = kzalloc(sizeof(*chain), GFP_KERNEL); + chain = kzalloc_obj(*chain, GFP_KERNEL); if (chain == NULL) return NULL; @@ -2193,7 +2193,7 @@ static int uvc_probe(struct usb_interface *intf, int ret; /* Allocate memory for the device and initialize it. */ - dev = kzalloc(sizeof(*dev), GFP_KERNEL); + dev = kzalloc_obj(*dev, GFP_KERNEL); if (dev == NULL) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvc_metadata.c b/drivers/media/usb/uvc/uvc_metadata.c index c23b174965c3..59e2b05aaf21 100644 --- a/drivers/media/usb/uvc/uvc_metadata.c +++ b/drivers/media/usb/uvc/uvc_metadata.c @@ -181,7 +181,7 @@ static int uvc_meta_detect_msxu(struct uvc_device *dev) * USB requires buffers aligned in a special way, simplest way is to * make sure that query_ctrl will work is to kmalloc() them. */ - data = kmalloc(sizeof(*data), GFP_KERNEL); + data = kmalloc_obj(*data, GFP_KERNEL); if (!data) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvc_status.c b/drivers/media/usb/uvc/uvc_status.c index 231cfee8e7c2..018d25101bb8 100644 --- a/drivers/media/usb/uvc/uvc_status.c +++ b/drivers/media/usb/uvc/uvc_status.c @@ -263,7 +263,7 @@ int uvc_status_init(struct uvc_device *dev) if (ep == NULL) return 0; - dev->status = kzalloc(sizeof(*dev->status), GFP_KERNEL); + dev->status = kzalloc_obj(*dev->status, GFP_KERNEL); if (!dev->status) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvc_v4l2.c b/drivers/media/usb/uvc/uvc_v4l2.c index 30c160daed8c..98e6c4135dfd 100644 --- a/drivers/media/usb/uvc/uvc_v4l2.c +++ b/drivers/media/usb/uvc/uvc_v4l2.c @@ -133,7 +133,7 @@ static int uvc_ioctl_xu_ctrl_map(struct uvc_video_chain *chain, return -EINVAL; } - map = kzalloc(sizeof(*map), GFP_KERNEL); + map = kzalloc_obj(*map, GFP_KERNEL); if (map == NULL) return -ENOMEM; @@ -572,7 +572,7 @@ static int uvc_v4l2_open(struct file *file) uvc_dbg(stream->dev, CALLS, "%s\n", __func__); /* Create the device handle. */ - handle = kzalloc(sizeof(*handle), GFP_KERNEL); + handle = kzalloc_obj(*handle, GFP_KERNEL); if (!handle) return -ENOMEM; diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c index 59eb95a4b70c..249a225563f9 100644 --- a/drivers/media/usb/uvc/uvc_video.c +++ b/drivers/media/usb/uvc/uvc_video.c @@ -682,8 +682,7 @@ static int uvc_video_clock_init(struct uvc_clock *clock) spin_lock_init(&clock->lock); clock->size = 32; - clock->samples = kmalloc_array(clock->size, sizeof(*clock->samples), - GFP_KERNEL); + clock->samples = kmalloc_objs(*clock->samples, clock->size, GFP_KERNEL); if (clock->samples == NULL) return -ENOMEM; diff --git a/drivers/media/v4l2-core/tuner-core.c b/drivers/media/v4l2-core/tuner-core.c index 5687089bea6e..b6e7c11ef7e5 100644 --- a/drivers/media/v4l2-core/tuner-core.c +++ b/drivers/media/v4l2-core/tuner-core.c @@ -633,7 +633,7 @@ static int tuner_probe(struct i2c_client *client) int ret; #endif - t = kzalloc(sizeof(struct tuner), GFP_KERNEL); + t = kzalloc_obj(struct tuner, GFP_KERNEL); if (NULL == t) return -ENOMEM; v4l2_i2c_subdev_init(&t->sd, client, &tuner_ops); diff --git a/drivers/media/v4l2-core/v4l2-async.c b/drivers/media/v4l2-core/v4l2-async.c index 1c08bba9ecb9..c04a0e7c6edf 100644 --- a/drivers/media/v4l2-core/v4l2-async.c +++ b/drivers/media/v4l2-core/v4l2-async.c @@ -779,7 +779,7 @@ int v4l2_async_subdev_endpoint_add(struct v4l2_subdev *sd, { struct v4l2_async_subdev_endpoint *ase; - ase = kmalloc(sizeof(*ase), GFP_KERNEL); + ase = kmalloc_obj(*ase, GFP_KERNEL); if (!ase) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-ctrls-api.c b/drivers/media/v4l2-core/v4l2-ctrls-api.c index 0078a04c5445..03040c8eaa79 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-api.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-api.c @@ -431,8 +431,7 @@ int v4l2_g_ext_ctrls_common(struct v4l2_ctrl_handler *hdl, return class_check(hdl, cs->which); if (cs->count > ARRAY_SIZE(helper)) { - helpers = kvmalloc_array(cs->count, sizeof(helper[0]), - GFP_KERNEL); + helpers = kvmalloc_objs(helper[0], cs->count, GFP_KERNEL); if (!helpers) return -ENOMEM; } @@ -617,8 +616,7 @@ int try_set_ext_ctrls_common(struct v4l2_fh *fh, return class_check(hdl, cs->which); if (cs->count > ARRAY_SIZE(helper)) { - helpers = kvmalloc_array(cs->count, sizeof(helper[0]), - GFP_KERNEL); + helpers = kvmalloc_objs(helper[0], cs->count, GFP_KERNEL); if (!helpers) return -ENOMEM; } diff --git a/drivers/media/v4l2-core/v4l2-ctrls-core.c b/drivers/media/v4l2-core/v4l2-ctrls-core.c index 79a157975f70..3e8b4a38b8ae 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-core.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-core.c @@ -1725,8 +1725,8 @@ int v4l2_ctrl_handler_init_class(struct v4l2_ctrl_handler *hdl, INIT_LIST_HEAD(&hdl->ctrls); INIT_LIST_HEAD(&hdl->ctrl_refs); hdl->nr_of_buckets = 1 + nr_of_controls_hint / 8; - hdl->buckets = kvcalloc(hdl->nr_of_buckets, sizeof(hdl->buckets[0]), - GFP_KERNEL); + hdl->buckets = kvzalloc_objs(hdl->buckets[0], hdl->nr_of_buckets, + GFP_KERNEL); hdl->error = hdl->buckets ? 0 : -ENOMEM; v4l2_ctrl_handler_init_request(hdl); return hdl->error; diff --git a/drivers/media/v4l2-core/v4l2-ctrls-request.c b/drivers/media/v4l2-core/v4l2-ctrls-request.c index e77f722b36a4..e6d7f731d01a 100644 --- a/drivers/media/v4l2-core/v4l2-ctrls-request.c +++ b/drivers/media/v4l2-core/v4l2-ctrls-request.c @@ -198,7 +198,7 @@ v4l2_ctrls_find_req_obj(struct v4l2_ctrl_handler *hdl, if (!set) return ERR_PTR(-ENOMEM); - new_hdl = kzalloc(sizeof(*new_hdl), GFP_KERNEL); + new_hdl = kzalloc_obj(*new_hdl, GFP_KERNEL); if (!new_hdl) return ERR_PTR(-ENOMEM); @@ -341,7 +341,7 @@ void v4l2_ctrl_request_complete(struct media_request *req, int ret; /* Create a new request so the driver can return controls */ - hdl = kzalloc(sizeof(*hdl), GFP_KERNEL); + hdl = kzalloc_obj(*hdl, GFP_KERNEL); if (!hdl) return; diff --git a/drivers/media/v4l2-core/v4l2-dev.c b/drivers/media/v4l2-core/v4l2-dev.c index 10a126e50c1c..8add56232e84 100644 --- a/drivers/media/v4l2-core/v4l2-dev.c +++ b/drivers/media/v4l2-core/v4l2-dev.c @@ -146,7 +146,7 @@ static inline int devnode_find(struct video_device *vdev, int from, int to) struct video_device *video_device_alloc(void) { - return kzalloc(sizeof(struct video_device), GFP_KERNEL); + return kzalloc_obj(struct video_device, GFP_KERNEL); } EXPORT_SYMBOL(video_device_alloc); diff --git a/drivers/media/v4l2-core/v4l2-device.c b/drivers/media/v4l2-core/v4l2-device.c index 63b12ef9d4d9..779ae282ab11 100644 --- a/drivers/media/v4l2-core/v4l2-device.c +++ b/drivers/media/v4l2-core/v4l2-device.c @@ -205,7 +205,7 @@ int __v4l2_device_register_subdev_nodes(struct v4l2_device *v4l2_dev, if (sd->devnode) continue; - vdev = kzalloc(sizeof(*vdev), GFP_KERNEL); + vdev = kzalloc_obj(*vdev, GFP_KERNEL); if (!vdev) { err = -ENOMEM; goto clean_up; diff --git a/drivers/media/v4l2-core/v4l2-dv-timings.c b/drivers/media/v4l2-core/v4l2-dv-timings.c index 346d1b0e10ce..a6233bdab3d4 100644 --- a/drivers/media/v4l2-core/v4l2-dv-timings.c +++ b/drivers/media/v4l2-core/v4l2-dv-timings.c @@ -1237,7 +1237,7 @@ struct v4l2_debugfs_if *v4l2_debugfs_if_alloc(struct dentry *root, u32 if_types, if (IS_ERR_OR_NULL(root) || !if_types || !if_read) return NULL; - infoframes = kzalloc(sizeof(*infoframes), GFP_KERNEL); + infoframes = kzalloc_obj(*infoframes, GFP_KERNEL); if (!infoframes) return NULL; diff --git a/drivers/media/v4l2-core/v4l2-event.c b/drivers/media/v4l2-core/v4l2-event.c index 3898ff7edddb..b92561fb65d4 100644 --- a/drivers/media/v4l2-core/v4l2-event.c +++ b/drivers/media/v4l2-core/v4l2-event.c @@ -235,7 +235,7 @@ int v4l2_event_subscribe(struct v4l2_fh *fh, if (elems < 1) elems = 1; - sev = kvzalloc(struct_size(sev, events, elems), GFP_KERNEL); + sev = kvzalloc_flex(*sev, events, elems, GFP_KERNEL); if (!sev) return -ENOMEM; sev->elems = elems; diff --git a/drivers/media/v4l2-core/v4l2-fh.c b/drivers/media/v4l2-core/v4l2-fh.c index df3ba9d4674b..fdd247b945a3 100644 --- a/drivers/media/v4l2-core/v4l2-fh.c +++ b/drivers/media/v4l2-core/v4l2-fh.c @@ -57,7 +57,7 @@ EXPORT_SYMBOL_GPL(v4l2_fh_add); int v4l2_fh_open(struct file *filp) { struct video_device *vdev = video_devdata(filp); - struct v4l2_fh *fh = kzalloc(sizeof(*fh), GFP_KERNEL); + struct v4l2_fh *fh = kzalloc_obj(*fh, GFP_KERNEL); if (fh == NULL) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-flash-led-class.c b/drivers/media/v4l2-core/v4l2-flash-led-class.c index 355595a0fefa..735434d4b4c2 100644 --- a/drivers/media/v4l2-core/v4l2-flash-led-class.c +++ b/drivers/media/v4l2-core/v4l2-flash-led-class.c @@ -443,8 +443,8 @@ static int v4l2_flash_init_controls(struct v4l2_flash *v4l2_flash, return -ENOMEM; /* allocate memory dynamically so as not to exceed stack frame size */ - ctrl_init_data = kcalloc(NUM_FLASH_CTRLS, sizeof(*ctrl_init_data), - GFP_KERNEL); + ctrl_init_data = kzalloc_objs(*ctrl_init_data, NUM_FLASH_CTRLS, + GFP_KERNEL); if (!ctrl_init_data) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c b/drivers/media/v4l2-core/v4l2-fwnode.c index 22ec702a4567..c3ea009b8ffb 100644 --- a/drivers/media/v4l2-core/v4l2-fwnode.c +++ b/drivers/media/v4l2-core/v4l2-fwnode.c @@ -785,7 +785,7 @@ int v4l2_fwnode_connector_add_link(struct fwnode_handle *fwnode, if (!connector_ep) return -ENOTCONN; - link = kzalloc(sizeof(*link), GFP_KERNEL); + link = kzalloc_obj(*link, GFP_KERNEL); if (!link) { err = -ENOMEM; goto err; @@ -1257,7 +1257,7 @@ int v4l2_async_register_subdev_sensor(struct v4l2_subdev *sd) if (WARN_ON(!sd->dev)) return -ENODEV; - notifier = kzalloc(sizeof(*notifier), GFP_KERNEL); + notifier = kzalloc_obj(*notifier, GFP_KERNEL); if (!notifier) return -ENOMEM; diff --git a/drivers/media/v4l2-core/v4l2-mem2mem.c b/drivers/media/v4l2-core/v4l2-mem2mem.c index b661f483dad3..2c933f4644aa 100644 --- a/drivers/media/v4l2-core/v4l2-mem2mem.c +++ b/drivers/media/v4l2-core/v4l2-mem2mem.c @@ -1190,7 +1190,7 @@ struct v4l2_m2m_dev *v4l2_m2m_init(const struct v4l2_m2m_ops *m2m_ops) if (!m2m_ops || WARN_ON(!m2m_ops->device_run)) return ERR_PTR(-EINVAL); - m2m_dev = kzalloc(sizeof *m2m_dev, GFP_KERNEL); + m2m_dev = kzalloc_obj(*m2m_dev, GFP_KERNEL); if (!m2m_dev) return ERR_PTR(-ENOMEM); @@ -1238,7 +1238,7 @@ struct v4l2_m2m_ctx *v4l2_m2m_ctx_init(struct v4l2_m2m_dev *m2m_dev, struct v4l2_m2m_queue_ctx *out_q_ctx, *cap_q_ctx; int ret; - m2m_ctx = kzalloc(sizeof *m2m_ctx, GFP_KERNEL); + m2m_ctx = kzalloc_obj(*m2m_ctx, GFP_KERNEL); if (!m2m_ctx) return ERR_PTR(-ENOMEM); diff --git a/drivers/media/v4l2-core/v4l2-subdev.c b/drivers/media/v4l2-core/v4l2-subdev.c index 66842b975f91..c358cb40b829 100644 --- a/drivers/media/v4l2-core/v4l2-subdev.c +++ b/drivers/media/v4l2-core/v4l2-subdev.c @@ -99,7 +99,7 @@ static int subdev_open(struct file *file) struct v4l2_subdev_fh *subdev_fh; int ret; - subdev_fh = kzalloc(sizeof(*subdev_fh), GFP_KERNEL); + subdev_fh = kzalloc_obj(*subdev_fh, GFP_KERNEL); if (subdev_fh == NULL) return -ENOMEM; @@ -1606,7 +1606,7 @@ __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const char *lock_name, struct v4l2_subdev_state *state; int ret; - state = kzalloc(sizeof(*state), GFP_KERNEL); + state = kzalloc_obj(*state, GFP_KERNEL); if (!state) return ERR_PTR(-ENOMEM); @@ -1620,8 +1620,8 @@ __v4l2_subdev_state_alloc(struct v4l2_subdev *sd, const char *lock_name, /* Drivers that support streams do not need the legacy pad config */ if (!(sd->flags & V4L2_SUBDEV_FL_STREAMS) && sd->entity.num_pads) { - state->pads = kvcalloc(sd->entity.num_pads, - sizeof(*state->pads), GFP_KERNEL); + state->pads = kvzalloc_objs(*state->pads, sd->entity.num_pads, + GFP_KERNEL); if (!state->pads) { ret = -ENOMEM; goto err; @@ -1889,9 +1889,9 @@ v4l2_subdev_init_stream_configs(struct v4l2_subdev_stream_configs *stream_config } if (new_configs.num_configs) { - new_configs.configs = kvcalloc(new_configs.num_configs, - sizeof(*new_configs.configs), - GFP_KERNEL); + new_configs.configs = kvzalloc_objs(*new_configs.configs, + new_configs.num_configs, + GFP_KERNEL); if (!new_configs.configs) return -ENOMEM; |
