imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,31 +1,31 @@
 struct dvb_frontend *ds3000_attach(const struct ds3000_config *config, struct i2c_adapter *i2c) {
   struct ds3000_state *state;
   int ret;
   dprintk("%s\n", __func__);
   /* allocate memory for the internal state */
-  state = kzalloc(sizeof(struct ds3000_state), GFP_KERNEL);
+  state = kzalloc(sizeof(*state), GFP_KERNEL);
   if (!state) goto error2;
   state->config = config;
   state->i2c = i2c;
   state->prevUCBS2 = 0;
   /* check if the demod is present */
   ret = ds3000_readreg(state, 0x00) & 0xfe;
   if (ret != 0xe0) {
     printk(KERN_ERR "Invalid probe, probably not a DS3000\n");
     goto error3;
   }
   printk(KERN_INFO "DS3000 chip version: %d.%d attached.\n", ds3000_readreg(state, 0x02), ds3000_readreg(state, 0x01));
   memcpy(&state->frontend.ops, &ds3000_ops, sizeof(struct dvb_frontend_ops));
   state->frontend.demodulator_priv = state;
   /*
    * Some devices like T480 starts with voltage on. Be sure
    * to turn voltage off during init, as this can otherwise
    * interfere with Unicable SCR systems.
    */
   ds3000_set_voltage(&state->frontend, SEC_VOLTAGE_OFF);
   return &state->frontend;
 error3:
   kfree(state);
 error2:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,43 +1,43 @@
 static int hexium_attach(struct saa7146_dev *dev, struct saa7146_pci_extension_data *info) {
   struct hexium *hexium;
   int ret;
   DEB_EE("\n");
-  hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
+  hexium = kzalloc(sizeof(*hexium), GFP_KERNEL);
   if (!hexium) return -ENOMEM;
   dev->ext_priv = hexium;
   /* enable i2c-port pins */
   saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
   hexium->i2c_adapter = (struct i2c_adapter){
       .name = "hexium gemini",
   };
   saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
   if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
     DEB_S("cannot register i2c-device. skipping.\n");
     kfree(hexium);
     return -EFAULT;
   }
   /*  set HWControl GPIO number 2 */
   saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI);
   saa7146_write(dev, DD1_INIT, 0x07000700);
   saa7146_write(dev, DD1_STREAM_B, 0x00000000);
   saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
   /* the rest */
   hexium->cur_input = 0;
   hexium_init_done(dev);
   hexium_set_standard(hexium, hexium_pal);
   hexium->cur_std = V4L2_STD_PAL;
   hexium_set_input(hexium, 0);
   hexium->cur_input = 0;
   saa7146_vv_init(dev, &vv_data);
   vv_data.vid_ops.vidioc_enum_input = vidioc_enum_input;
   vv_data.vid_ops.vidioc_g_input = vidioc_g_input;
   vv_data.vid_ops.vidioc_s_input = vidioc_s_input;
   ret = saa7146_register_device(&hexium->video_dev, dev, "hexium gemini", VFL_TYPE_GRABBER);
   if (ret < 0) {
     pr_err("cannot register capture v4l2 device. skipping.\n");
     return ret;
   }
   pr_info("found 'hexium gemini' frame grabber-%d\n", hexium_num);
   hexium_num++;
   return 0;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,56 +1,56 @@
 static int hexium_probe(struct saa7146_dev *dev) {
   struct hexium *hexium = NULL;
   union i2c_smbus_data data;
   int err = 0;
   DEB_EE("\n");
   /* there are no hexium orion cards with revision 0 saa7146s */
   if (0 == dev->revision) { return -EFAULT; }
-  hexium = kzalloc(sizeof(struct hexium), GFP_KERNEL);
+  hexium = kzalloc(sizeof(*hexium), GFP_KERNEL);
   if (!hexium) return -ENOMEM;
   /* enable i2c-port pins */
   saa7146_write(dev, MC1, (MASK_08 | MASK_24 | MASK_10 | MASK_26));
   saa7146_write(dev, DD1_INIT, 0x01000100);
   saa7146_write(dev, DD1_STREAM_B, 0x00000000);
   saa7146_write(dev, MC2, (MASK_09 | MASK_25 | MASK_10 | MASK_26));
   hexium->i2c_adapter = (struct i2c_adapter){
       .name = "hexium orion",
   };
   saa7146_i2c_adapter_prepare(dev, &hexium->i2c_adapter, SAA7146_I2C_BUS_BIT_RATE_480);
   if (i2c_add_adapter(&hexium->i2c_adapter) < 0) {
     DEB_S("cannot register i2c-device. skipping.\n");
     kfree(hexium);
     return -EFAULT;
   }
   /* set SAA7110 control GPIO 0 */
   saa7146_setgpio(dev, 0, SAA7146_GPIO_OUTHI);
   /*  set HWControl GPIO number 2 */
   saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI);
   mdelay(10);
   /* detect newer Hexium Orion cards by subsystem ids */
   if (0x17c8 == dev->pci->subsystem_vendor && 0x0101 == dev->pci->subsystem_device) {
     pr_info("device is a Hexium Orion w/ 1 SVHS + 3 BNC inputs\n");
     /* we store the pointer in our private data field */
     dev->ext_priv = hexium;
     hexium->type = HEXIUM_ORION_1SVHS_3BNC;
     return 0;
   }
   if (0x17c8 == dev->pci->subsystem_vendor && 0x2101 == dev->pci->subsystem_device) {
     pr_info("device is a Hexium Orion w/ 4 BNC inputs\n");
     /* we store the pointer in our private data field */
     dev->ext_priv = hexium;
     hexium->type = HEXIUM_ORION_4BNC;
     return 0;
   }
   /* check if this is an old hexium Orion card by looking at
      a saa7110 at address 0x4e */
   if (0 == (err = i2c_smbus_xfer(&hexium->i2c_adapter, 0x4e, 0, I2C_SMBUS_READ, 0x00, I2C_SMBUS_BYTE_DATA, &data))) {
     pr_info("device is a Hexium HV-PCI6/Orion (old)\n");
     /* we store the pointer in our private data field */
     dev->ext_priv = hexium;
     hexium->type = HEXIUM_HV_PCI6_ORION;
     return 0;
   }
   i2c_del_adapter(&hexium->i2c_adapter);
   kfree(hexium);
   return -EFAULT;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,66 +1,66 @@
 static int hopper_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) {
   struct mantis_pci_drvdata *drvdata;
   struct mantis_pci *mantis;
   struct mantis_hwconfig *config;
   int err;
-  mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+  mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
   if (mantis == NULL) {
     err = -ENOMEM;
     goto fail0;
   }
   drvdata = (void *)pci_id->driver_data;
   mantis->num = devs;
   mantis->verbose = verbose;
   mantis->pdev = pdev;
   config = drvdata->hwconfig;
   config->irq_handler = &hopper_irq_handler;
   mantis->hwconfig = config;
   mantis->rc_map_name = drvdata->rc_map_name;
   spin_lock_init(&mantis->intmask_lock);
   err = mantis_pci_init(mantis);
   if (err) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err);
     goto fail1;
   }
   err = mantis_stream_control(mantis, STREAM_TO_HIF);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err);
     goto fail1;
   }
   err = mantis_i2c_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err);
     goto fail2;
   }
   err = mantis_get_mac(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err);
     goto fail2;
   }
   err = mantis_dma_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err);
     goto fail3;
   }
   err = mantis_dvb_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
     goto fail4;
   }
   devs++;
   return err;
 fail4:
   dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA exit! <%d>", err);
   mantis_dma_exit(mantis);
 fail3:
   dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C exit! <%d>", err);
   mantis_i2c_exit(mantis);
 fail2:
   dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI exit! <%d>", err);
   mantis_pci_exit(mantis);
 fail1:
   dprintk(MANTIS_ERROR, 1, "ERROR: Mantis free! <%d>", err);
   kfree(mantis);
 fail0:
   return err;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,72 +1,72 @@
 static int mantis_pci_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id) {
   struct mantis_pci_drvdata *drvdata;
   struct mantis_pci *mantis;
   struct mantis_hwconfig *config;
   int err;
-  mantis = kzalloc(sizeof(struct mantis_pci), GFP_KERNEL);
+  mantis = kzalloc(sizeof(*mantis), GFP_KERNEL);
   if (!mantis) return -ENOMEM;
   drvdata = (void *)pci_id->driver_data;
   mantis->num = devs;
   mantis->verbose = verbose;
   mantis->pdev = pdev;
   config = drvdata->hwconfig;
   config->irq_handler = &mantis_irq_handler;
   mantis->hwconfig = config;
   mantis->rc_map_name = drvdata->rc_map_name;
   spin_lock_init(&mantis->intmask_lock);
   err = mantis_pci_init(mantis);
   if (err) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis PCI initialization failed <%d>", err);
     goto err_free_mantis;
   }
   err = mantis_stream_control(mantis, STREAM_TO_HIF);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis stream control failed <%d>", err);
     goto err_pci_exit;
   }
   err = mantis_i2c_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis I2C initialization failed <%d>", err);
     goto err_pci_exit;
   }
   err = mantis_get_mac(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis MAC address read failed <%d>", err);
     goto err_i2c_exit;
   }
   err = mantis_dma_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DMA initialization failed <%d>", err);
     goto err_i2c_exit;
   }
   err = mantis_dvb_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
     goto err_dma_exit;
   }
   err = mantis_input_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis DVB initialization failed <%d>", err);
     goto err_dvb_exit;
   }
   err = mantis_uart_init(mantis);
   if (err < 0) {
     dprintk(MANTIS_ERROR, 1, "ERROR: Mantis UART initialization failed <%d>", err);
     goto err_input_exit;
   }
   devs++;
   return 0;
 err_input_exit:
   mantis_input_exit(mantis);
 err_dvb_exit:
   mantis_dvb_exit(mantis);
 err_dma_exit:
   mantis_dma_exit(mantis);
 err_i2c_exit:
   mantis_i2c_exit(mantis);
 err_pci_exit:
   mantis_pci_exit(mantis);
 err_free_mantis:
   kfree(mantis);
   return err;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,26 +1,26 @@
 struct dvb_frontend *mb86a20s_attach(const struct mb86a20s_config *config, struct i2c_adapter *i2c) {
   struct mb86a20s_state *state;
   u8 rev;
   dev_dbg(&i2c->dev, "%s called.\n", __func__);
   /* allocate memory for the internal state */
-  state = kzalloc(sizeof(struct mb86a20s_state), GFP_KERNEL);
+  state = kzalloc(sizeof(*state), GFP_KERNEL);
   if (!state) goto error;
   /* setup the state */
   state->config = config;
   state->i2c = i2c;
   /* create dvb_frontend */
   memcpy(&state->frontend.ops, &mb86a20s_ops, sizeof(struct dvb_frontend_ops));
   state->frontend.demodulator_priv = state;
   /* Check if it is a mb86a20s frontend */
   rev = mb86a20s_readreg(state, 0);
   if (rev == 0x13) {
     dev_info(&i2c->dev, "Detected a Fujitsu mb86a20s frontend\n");
   } else {
     dev_dbg(&i2c->dev, "Frontend revision %d is unknown - aborting.\n", rev);
     goto error;
   }
   return &state->frontend;
 error:
   kfree(state);
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,46 +1,46 @@
 struct saa7164_buffer *saa7164_buffer_alloc(struct saa7164_port *port, u32 len) {
   struct tmHWStreamParameters *params = &port->hw_streamingparams;
   struct saa7164_buffer *buf = NULL;
   struct saa7164_dev *dev = port->dev;
   int i;
   if ((len == 0) || (len >= 65536) || (len % sizeof(u64))) {
     log_warn("%s() SAA_ERR_BAD_PARAMETER\n", __func__);
     goto ret;
   }
-  buf = kzalloc(sizeof(struct saa7164_buffer), GFP_KERNEL);
+  buf = kzalloc(sizeof(*buf), GFP_KERNEL);
   if (!buf) goto ret;
   buf->idx = -1;
   buf->port = port;
   buf->flags = SAA7164_BUFFER_FREE;
   buf->pos = 0;
   buf->actual_size = params->pitch * params->numberoflines;
   buf->crc = 0;
   /* TODO: arg len is being ignored */
   buf->pci_size = SAA7164_PT_ENTRIES * 0x1000;
   buf->pt_size = (SAA7164_PT_ENTRIES * sizeof(u64)) + 0x1000;
   /* Allocate contiguous memory */
   buf->cpu = pci_alloc_consistent(port->dev->pci, buf->pci_size, &buf->dma);
   if (!buf->cpu) goto fail1;
   buf->pt_cpu = pci_alloc_consistent(port->dev->pci, buf->pt_size, &buf->pt_dma);
   if (!buf->pt_cpu) goto fail2;
   /* init the buffers to a known pattern, easier during debugging */
   memset(buf->cpu, 0xff, buf->pci_size);
   buf->crc = crc32(0, buf->cpu, buf->actual_size);
   memset(buf->pt_cpu, 0xff, buf->pt_size);
   dprintk(DBGLVL_BUF, "%s()   allocated buffer @ 0x%p (%d pageptrs)\n", __func__, buf, params->numpagetables);
   dprintk(DBGLVL_BUF, "  pci_cpu @ 0x%p    dma @ 0x%08lx len = 0x%x\n", buf->cpu, (long)buf->dma, buf->pci_size);
   dprintk(DBGLVL_BUF, "   pt_cpu @ 0x%p pt_dma @ 0x%08lx len = 0x%x\n", buf->pt_cpu, (long)buf->pt_dma, buf->pt_size);
   /* Format the Page Table Entries to point into the data buffer */
   for (i = 0; i < params->numpagetables; i++) {
     *(buf->pt_cpu + i) = buf->dma + (i * 0x1000); /* TODO */
     dprintk(DBGLVL_BUF, "    pt[%02d] = 0x%p -> 0x%llx\n", i, buf->pt_cpu, (u64) * (buf->pt_cpu));
   }
   goto ret;
 fail2:
   pci_free_consistent(port->dev->pci, buf->pci_size, buf->cpu, buf->dma);
 fail1:
   kfree(buf);
   buf = NULL;
 ret:
   return buf;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,15 +1,15 @@
 struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, u32 len) {
   struct saa7164_user_buffer *buf;
-  buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL);
+  buf = kzalloc(sizeof(*buf), GFP_KERNEL);
   if (!buf) return NULL;
   buf->data = kzalloc(len, GFP_KERNEL);
   if (!buf->data) {
     kfree(buf);
     return NULL;
   }
   buf->actual_size = len;
   buf->pos = 0;
   buf->crc = 0;
   dprintk(DBGLVL_BUF, "%s()   allocated user buffer @ 0x%p\n", __func__, buf);
   return buf;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,9 +1,9 @@
 static struct smscore_buffer_t *smscore_createbuffer(u8 *buffer, void *common_buffer, dma_addr_t common_buffer_phys) {
   struct smscore_buffer_t *cb;
-  cb = kzalloc(sizeof(struct smscore_buffer_t), GFP_KERNEL);
+  cb = kzalloc(sizeof(*cb), GFP_KERNEL);
   if (!cb) return NULL;
   cb->p = buffer;
   cb->offset_in_common = buffer - (u8 *)common_buffer;
   cb->phys = common_buffer_phys + cb->offset_in_common;
   return cb;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,21 +1,21 @@
 static struct smscore_registry_entry_t *smscore_find_registry(char *devpath) {
   struct smscore_registry_entry_t *entry;
   struct list_head *next;
   kmutex_lock(&g_smscore_registrylock);
   for (next = g_smscore_registry.next; next != &g_smscore_registry; next = next->next) {
     entry = (struct smscore_registry_entry_t *)next;
     if (!strcmp(entry->devpath, devpath)) {
       kmutex_unlock(&g_smscore_registrylock);
       return entry;
     }
   }
-  entry = kmalloc(sizeof(struct smscore_registry_entry_t), GFP_KERNEL);
+  entry = kmalloc(sizeof(*entry), GFP_KERNEL);
   if (entry) {
     entry->mode = default_mode;
     strcpy(entry->devpath, devpath);
     list_add(&entry->entry, &g_smscore_registry);
   } else
     pr_err("failed to create smscore_registry.\n");
   kmutex_unlock(&g_smscore_registrylock);
   return entry;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,20 +1,20 @@
 int smscore_register_client(struct smscore_device_t *coredev, struct smsclient_params_t *params, struct smscore_client_t **client) {
   struct smscore_client_t *newclient;
   /* check that no other channel with same parameters exists */
   if (smscore_find_client(coredev, params->data_type, params->initial_id)) {
     pr_err("Client already exist.\n");
     return -EEXIST;
   }
-  newclient = kzalloc(sizeof(struct smscore_client_t), GFP_KERNEL);
+  newclient = kzalloc(sizeof(*newclient), GFP_KERNEL);
   if (!newclient) return -ENOMEM;
   INIT_LIST_HEAD(&newclient->idlist);
   newclient->coredev = coredev;
   newclient->onresponse_handler = params->onresponse_handler;
   newclient->onremove_handler = params->onremove_handler;
   newclient->context = params->context;
   list_add_locked(&newclient->entry, &coredev->clients, &coredev->clientslock);
   smscore_validate_client(coredev, newclient, params->data_type, params->initial_id);
   *client = newclient;
   pr_debug("%p %d %d\n", params->context, params->data_type, params->initial_id);
   return 0;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,68 +1,68 @@
 int smscore_register_device(struct smsdevice_params_t *params, struct smscore_device_t **coredev, void *mdev) {
   struct smscore_device_t *dev;
   u8 *buffer;
-  dev = kzalloc(sizeof(struct smscore_device_t), GFP_KERNEL);
+  dev = kzalloc(sizeof(*dev), GFP_KERNEL);
   if (!dev) return -ENOMEM;
 #ifdef CONFIG_MEDIA_CONTROLLER_DVB
   dev->media_dev = mdev;
 #endif
   /* init list entry so it could be safe in smscore_unregister_device */
   INIT_LIST_HEAD(&dev->entry);
   /* init queues */
   INIT_LIST_HEAD(&dev->clients);
   INIT_LIST_HEAD(&dev->buffers);
   /* init locks */
   spin_lock_init(&dev->clientslock);
   spin_lock_init(&dev->bufferslock);
   /* init completion events */
   init_completion(&dev->version_ex_done);
   init_completion(&dev->data_download_done);
   init_completion(&dev->data_validity_done);
   init_completion(&dev->trigger_done);
   init_completion(&dev->init_device_done);
   init_completion(&dev->reload_start_done);
   init_completion(&dev->resume_done);
   init_completion(&dev->gpio_configuration_done);
   init_completion(&dev->gpio_set_level_done);
   init_completion(&dev->gpio_get_level_done);
   init_completion(&dev->ir_init_done);
   /* Buffer management */
   init_waitqueue_head(&dev->buffer_mng_waitq);
   /* alloc common buffer */
   dev->common_buffer_size = params->buffer_size * params->num_buffers;
   dev->common_buffer = dma_alloc_coherent(NULL, dev->common_buffer_size, &dev->common_buffer_phys, GFP_KERNEL | GFP_DMA);
   if (!dev->common_buffer) {
     smscore_unregister_device(dev);
     return -ENOMEM;
   }
   /* prepare dma buffers */
   for (buffer = dev->common_buffer; dev->num_buffers < params->num_buffers; dev->num_buffers++, buffer += params->buffer_size) {
     struct smscore_buffer_t *cb;
     cb = smscore_createbuffer(buffer, dev->common_buffer, dev->common_buffer_phys);
     if (!cb) {
       smscore_unregister_device(dev);
       return -ENOMEM;
     }
     smscore_putbuffer(dev, cb);
   }
   pr_debug("allocated %d buffers\n", dev->num_buffers);
   dev->mode = DEVICE_MODE_NONE;
   dev->board_id = SMS_BOARD_UNKNOWN;
   dev->context = params->context;
   dev->device = params->device;
   dev->setmode_handler = params->setmode_handler;
   dev->detectmode_handler = params->detectmode_handler;
   dev->sendrequest_handler = params->sendrequest_handler;
   dev->preload_handler = params->preload_handler;
   dev->postload_handler = params->postload_handler;
   dev->device_flags = params->flags;
   strcpy(dev->devpath, params->devpath);
   smscore_registry_settype(dev->devpath, params->device_type);
   /* add device to devices list */
   kmutex_lock(&g_smscore_deviceslock);
   list_add(&dev->entry, &g_smscore_devices);
   kmutex_unlock(&g_smscore_deviceslock);
   *coredev = dev;
   pr_debug("device %p created\n", dev);
   return 0;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,23 +1,23 @@
 int smscore_register_hotplug(hotplug_t hotplug) {
   struct smscore_device_notifyee_t *notifyee;
   struct list_head *next, *first;
   int rc = 0;
   kmutex_lock(&g_smscore_deviceslock);
-  notifyee = kmalloc(sizeof(struct smscore_device_notifyee_t), GFP_KERNEL);
+  notifyee = kmalloc(sizeof(*notifyee), GFP_KERNEL);
   if (notifyee) {
     /* now notify callback about existing devices */
     first = &g_smscore_devices;
     for (next = first->next; next != first && !rc; next = next->next) {
       struct smscore_device_t *coredev = (struct smscore_device_t *)next;
       rc = hotplug(coredev, coredev->device, 1);
     }
     if (rc >= 0) {
       notifyee->hotplug = hotplug;
       list_add(&notifyee->entry, &g_smscore_notifyees);
     } else
       kfree(notifyee);
   } else
     rc = -ENOMEM;
   kmutex_unlock(&g_smscore_deviceslock);
   return rc;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,20 +1,20 @@
 static int smscore_validate_client(struct smscore_device_t *coredev, struct smscore_client_t *client, int data_type, int id) {
   struct smscore_idlist_t *listentry;
   struct smscore_client_t *registered_client;
   if (!client) {
     pr_err("bad parameter.\n");
     return -EINVAL;
   }
   registered_client = smscore_find_client(coredev, data_type, id);
   if (registered_client == client) return 0;
   if (registered_client) {
     pr_err("The msg ID already registered to another client.\n");
     return -EEXIST;
   }
-  listentry = kzalloc(sizeof(struct smscore_idlist_t), GFP_KERNEL);
+  listentry = kzalloc(sizeof(*listentry), GFP_KERNEL);
   if (!listentry) return -ENOMEM;
   listentry->id = id;
   listentry->data_type = data_type;
   list_add_locked(&listentry->entry, &client->idlist, &coredev->clientslock);
   return 0;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,24 +1,24 @@
 static int sp2_probe(struct i2c_client *client, const struct i2c_device_id *id) {
   struct sp2_config *cfg = client->dev.platform_data;
   struct sp2 *s;
   int ret;
   dev_dbg(&client->dev, "\n");
-  s = kzalloc(sizeof(struct sp2), GFP_KERNEL);
+  s = kzalloc(sizeof(*s), GFP_KERNEL);
   if (!s) {
     ret = -ENOMEM;
     goto err;
   }
   s->client = client;
   s->dvb_adap = cfg->dvb_adap;
   s->priv = cfg->priv;
   s->ci_control = cfg->ci_control;
   i2c_set_clientdata(client, s);
   ret = sp2_init(s);
   if (ret) goto err;
   dev_info(&s->client->dev, "CIMaX SP2 successfully attached\n");
   return 0;
 err:
   dev_dbg(&client->dev, "init failed=%d\n", ret);
   kfree(s);
   return ret;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)