imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,17 +1,17 @@
 struct vme_dma_attr *vme_dma_pattern_attribute(u32 pattern, u32 type) {
   struct vme_dma_attr *attributes;
   struct vme_dma_pattern *pattern_attr;
-  attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
+  attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
   if (!attributes) goto err_attr;
-  pattern_attr = kmalloc(sizeof(struct vme_dma_pattern), GFP_KERNEL);
+  pattern_attr = kmalloc(sizeof(*pattern_attr), GFP_KERNEL);
   if (!pattern_attr) goto err_pat;
   attributes->type = VME_DMA_PATTERN;
   attributes->private = (void *)pattern_attr;
   pattern_attr->pattern = pattern;
   pattern_attr->type = type;
   return attributes;
 err_pat:
   kfree(attributes);
 err_attr:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,17 +1,17 @@
 struct vme_dma_attr *vme_dma_pci_attribute(dma_addr_t address) {
   struct vme_dma_attr *attributes;
   struct vme_dma_pci *pci_attr;
   /* XXX Run some sanity checks here */
-  attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
+  attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
   if (!attributes) goto err_attr;
-  pci_attr = kmalloc(sizeof(struct vme_dma_pci), GFP_KERNEL);
+  pci_attr = kmalloc(sizeof(*pci_attr), GFP_KERNEL);
   if (!pci_attr) goto err_pci;
   attributes->type = VME_DMA_PCI;
   attributes->private = (void *)pci_attr;
   pci_attr->address = address;
   return attributes;
 err_pci:
   kfree(attributes);
 err_attr:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,46 +1,46 @@
 struct vme_resource *vme_dma_request(struct vme_dev *vdev, u32 route) {
   struct vme_bridge *bridge;
   struct list_head *dma_pos = NULL;
   struct vme_dma_resource *allocated_ctrlr = NULL;
   struct vme_dma_resource *dma_ctrlr = NULL;
   struct vme_resource *resource = NULL;
   /* XXX Not checking resource attributes */
   printk(KERN_ERR "No VME resource Attribute tests done\n");
   bridge = vdev->bridge;
   if (bridge == NULL) {
     printk(KERN_ERR "Can't find VME bus\n");
     goto err_bus;
   }
   /* Loop through DMA resources */
   list_for_each(dma_pos, &bridge->dma_resources) {
     dma_ctrlr = list_entry(dma_pos, struct vme_dma_resource, list);
     if (dma_ctrlr == NULL) {
       printk(KERN_ERR "Registered NULL DMA resource\n");
       continue;
     }
     /* Find an unlocked and compatible controller */
     mutex_lock(&dma_ctrlr->mtx);
     if (((dma_ctrlr->route_attr & route) == route) && (dma_ctrlr->locked == 0)) {
       dma_ctrlr->locked = 1;
       mutex_unlock(&dma_ctrlr->mtx);
       allocated_ctrlr = dma_ctrlr;
       break;
     }
     mutex_unlock(&dma_ctrlr->mtx);
   }
   /* Check to see if we found a resource */
   if (allocated_ctrlr == NULL) goto err_ctrlr;
-  resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+  resource = kmalloc(sizeof(*resource), GFP_KERNEL);
   if (!resource) goto err_alloc;
   resource->type = VME_DMA;
   resource->entry = &allocated_ctrlr->list;
   return resource;
 err_alloc:
   /* Unlock image */
   mutex_lock(&dma_ctrlr->mtx);
   dma_ctrlr->locked = 0;
   mutex_unlock(&dma_ctrlr->mtx);
 err_ctrlr:
 err_bus:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,19 +1,19 @@
 struct vme_dma_attr *vme_dma_vme_attribute(unsigned long long address, u32 aspace, u32 cycle, u32 dwidth) {
   struct vme_dma_attr *attributes;
   struct vme_dma_vme *vme_attr;
-  attributes = kmalloc(sizeof(struct vme_dma_attr), GFP_KERNEL);
+  attributes = kmalloc(sizeof(*attributes), GFP_KERNEL);
   if (!attributes) goto err_attr;
-  vme_attr = kmalloc(sizeof(struct vme_dma_vme), GFP_KERNEL);
+  vme_attr = kmalloc(sizeof(*vme_attr), GFP_KERNEL);
   if (!vme_attr) goto err_vme;
   attributes->type = VME_DMA_VME;
   attributes->private = (void *)vme_attr;
   vme_attr->address = address;
   vme_attr->aspace = aspace;
   vme_attr->cycle = cycle;
   vme_attr->dwidth = dwidth;
   return attributes;
 err_vme:
   kfree(attributes);
 err_attr:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,44 +1,44 @@
 struct vme_resource *vme_lm_request(struct vme_dev *vdev) {
   struct vme_bridge *bridge;
   struct list_head *lm_pos = NULL;
   struct vme_lm_resource *allocated_lm = NULL;
   struct vme_lm_resource *lm = NULL;
   struct vme_resource *resource = NULL;
   bridge = vdev->bridge;
   if (bridge == NULL) {
     printk(KERN_ERR "Can't find VME bus\n");
     goto err_bus;
   }
   /* Loop through LM resources */
   list_for_each(lm_pos, &bridge->lm_resources) {
     lm = list_entry(lm_pos, struct vme_lm_resource, list);
     if (lm == NULL) {
       printk(KERN_ERR "Registered NULL Location Monitor resource\n");
       continue;
     }
     /* Find an unlocked controller */
     mutex_lock(&lm->mtx);
     if (lm->locked == 0) {
       lm->locked = 1;
       mutex_unlock(&lm->mtx);
       allocated_lm = lm;
       break;
     }
     mutex_unlock(&lm->mtx);
   }
   /* Check to see if we found a resource */
   if (allocated_lm == NULL) goto err_lm;
-  resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+  resource = kmalloc(sizeof(*resource), GFP_KERNEL);
   if (!resource) goto err_alloc;
   resource->type = VME_LM;
   resource->entry = &allocated_lm->list;
   return resource;
 err_alloc:
   /* Unlock image */
   mutex_lock(&lm->mtx);
   lm->locked = 0;
   mutex_unlock(&lm->mtx);
 err_lm:
 err_bus:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,47 +1,47 @@
 struct vme_resource *vme_master_request(struct vme_dev *vdev, u32 address, u32 cycle, u32 dwidth) {
   struct vme_bridge *bridge;
   struct list_head *master_pos = NULL;
   struct vme_master_resource *allocated_image = NULL;
   struct vme_master_resource *master_image = NULL;
   struct vme_resource *resource = NULL;
   bridge = vdev->bridge;
   if (bridge == NULL) {
     printk(KERN_ERR "Can't find VME bus\n");
     goto err_bus;
   }
   /* Loop through master resources */
   list_for_each(master_pos, &bridge->master_resources) {
     master_image = list_entry(master_pos, struct vme_master_resource, list);
     if (master_image == NULL) {
       printk(KERN_WARNING "Registered NULL master resource\n");
       continue;
     }
     /* Find an unlocked and compatible image */
     spin_lock(&master_image->lock);
     if (((master_image->address_attr & address) == address) && ((master_image->cycle_attr & cycle) == cycle) && ((master_image->width_attr & dwidth) == dwidth) && (master_image->locked == 0)) {
       master_image->locked = 1;
       spin_unlock(&master_image->lock);
       allocated_image = master_image;
       break;
     }
     spin_unlock(&master_image->lock);
   }
   /* Check to see if we found a resource */
   if (allocated_image == NULL) {
     printk(KERN_ERR "Can't find a suitable resource\n");
     goto err_image;
   }
-  resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+  resource = kmalloc(sizeof(*resource), GFP_KERNEL);
   if (!resource) goto err_alloc;
   resource->type = VME_MASTER;
   resource->entry = &allocated_image->list;
   return resource;
 err_alloc:
   /* Unlock image */
   spin_lock(&master_image->lock);
   master_image->locked = 0;
   spin_unlock(&master_image->lock);
 err_image:
 err_bus:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,15 +1,15 @@
 struct vme_dma_list *vme_new_dma_list(struct vme_resource *resource) {
   struct vme_dma_resource *ctrlr;
   struct vme_dma_list *dma_list;
   if (resource->type != VME_DMA) {
     printk(KERN_ERR "Not a DMA resource\n");
     return NULL;
   }
   ctrlr = list_entry(resource->entry, struct vme_dma_resource, list);
-  dma_list = kmalloc(sizeof(struct vme_dma_list), GFP_KERNEL);
+  dma_list = kmalloc(sizeof(*dma_list), GFP_KERNEL);
   if (!dma_list) return NULL;
   INIT_LIST_HEAD(&dma_list->entries);
   dma_list->parent = ctrlr;
   mutex_init(&dma_list->mtx);
   return dma_list;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,44 +1,44 @@
 struct vme_resource *vme_slave_request(struct vme_dev *vdev, u32 address, u32 cycle) {
   struct vme_bridge *bridge;
   struct list_head *slave_pos = NULL;
   struct vme_slave_resource *allocated_image = NULL;
   struct vme_slave_resource *slave_image = NULL;
   struct vme_resource *resource = NULL;
   bridge = vdev->bridge;
   if (bridge == NULL) {
     printk(KERN_ERR "Can't find VME bus\n");
     goto err_bus;
   }
   /* Loop through slave resources */
   list_for_each(slave_pos, &bridge->slave_resources) {
     slave_image = list_entry(slave_pos, struct vme_slave_resource, list);
     if (slave_image == NULL) {
       printk(KERN_ERR "Registered NULL Slave resource\n");
       continue;
     }
     /* Find an unlocked and compatible image */
     mutex_lock(&slave_image->mtx);
     if (((slave_image->address_attr & address) == address) && ((slave_image->cycle_attr & cycle) == cycle) && (slave_image->locked == 0)) {
       slave_image->locked = 1;
       mutex_unlock(&slave_image->mtx);
       allocated_image = slave_image;
       break;
     }
     mutex_unlock(&slave_image->mtx);
   }
   /* No free image */
   if (allocated_image == NULL) goto err_image;
-  resource = kmalloc(sizeof(struct vme_resource), GFP_KERNEL);
+  resource = kmalloc(sizeof(*resource), GFP_KERNEL);
   if (!resource) goto err_alloc;
   resource->type = VME_SLAVE;
   resource->entry = &allocated_image->list;
   return resource;
 err_alloc:
   /* Unlock image */
   mutex_lock(&slave_image->mtx);
   slave_image->locked = 0;
   mutex_unlock(&slave_image->mtx);
 err_image:
 err_bus:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kmalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,56 +1,56 @@
 static int ca91cx42_alloc_resource(struct vme_master_resource *image, unsigned long long size) {
   unsigned long long existing_size;
   int retval = 0;
   struct pci_dev *pdev;
   struct vme_bridge *ca91cx42_bridge;
   ca91cx42_bridge = image->parent;
   /* Find pci_dev container of dev */
   if (ca91cx42_bridge->parent == NULL) {
     dev_err(ca91cx42_bridge->parent, "Dev entry NULL\n");
     return -EINVAL;
   }
   pdev = to_pci_dev(ca91cx42_bridge->parent);
   existing_size = (unsigned long long)(image->bus_resource.end - image->bus_resource.start);
   /* If the existing size is OK, return */
   if (existing_size == (size - 1)) return 0;
   if (existing_size != 0) {
     iounmap(image->kern_base);
     image->kern_base = NULL;
     kfree(image->bus_resource.name);
     release_resource(&image->bus_resource);
-    memset(&image->bus_resource, 0, sizeof(struct resource));
+    memset(&image->bus_resource, 0, sizeof(image->bus_resource));
   }
   if (image->bus_resource.name == NULL) {
     image->bus_resource.name = kmalloc(VMENAMSIZ + 3, GFP_ATOMIC);
     if (image->bus_resource.name == NULL) {
       retval = -ENOMEM;
       goto err_name;
     }
   }
   sprintf((char *)image->bus_resource.name, "%s.%d", ca91cx42_bridge->name, image->number);
   image->bus_resource.start = 0;
   image->bus_resource.end = (unsigned long)size;
   image->bus_resource.flags = IORESOURCE_MEM;
   retval = pci_bus_alloc_resource(pdev->bus, &image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM, 0, NULL, NULL);
   if (retval) {
     dev_err(ca91cx42_bridge->parent,
             "Failed to allocate mem "
             "resource for window %d size 0x%lx start 0x%lx\n",
             image->number, (unsigned long)size, (unsigned long)image->bus_resource.start);
     goto err_resource;
   }
   image->kern_base = ioremap_nocache(image->bus_resource.start, size);
   if (image->kern_base == NULL) {
     dev_err(ca91cx42_bridge->parent, "Failed to remap resource\n");
     retval = -ENOMEM;
     goto err_remap;
   }
   return 0;
 err_remap:
   release_resource(&image->bus_resource);
 err_resource:
   kfree(image->bus_resource.name);
-  memset(&image->bus_resource, 0, sizeof(struct resource));
+  memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 err_name:
   return retval;
 }<sep>@@
expression e1,e2;
type T;
@@

memset (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )
--- initial
+++ final
@@ -1,7 +1,7 @@
 static void ca91cx42_free_resource(struct vme_master_resource *image) {
   iounmap(image->kern_base);
   image->kern_base = NULL;
   release_resource(&image->bus_resource);
   kfree(image->bus_resource.name);
-  memset(&image->bus_resource, 0, sizeof(struct resource));
+  memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 }<sep>@@
expression e1,e2;
type T;
@@

memset (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )
--- initial
+++ final
@@ -1,53 +1,53 @@
 static int tsi148_alloc_resource(struct vme_master_resource *image, unsigned long long size) {
   unsigned long long existing_size;
   int retval = 0;
   struct pci_dev *pdev;
   struct vme_bridge *tsi148_bridge;
   tsi148_bridge = image->parent;
   pdev = to_pci_dev(tsi148_bridge->parent);
   existing_size = (unsigned long long)(image->bus_resource.end - image->bus_resource.start);
   /* If the existing size is OK, return */
   if ((size != 0) && (existing_size == (size - 1))) return 0;
   if (existing_size != 0) {
     iounmap(image->kern_base);
     image->kern_base = NULL;
     kfree(image->bus_resource.name);
     release_resource(&image->bus_resource);
-    memset(&image->bus_resource, 0, sizeof(struct resource));
+    memset(&image->bus_resource, 0, sizeof(image->bus_resource));
   }
   /* Exit here if size is zero */
   if (size == 0) return 0;
   if (image->bus_resource.name == NULL) {
     image->bus_resource.name = kmalloc(VMENAMSIZ + 3, GFP_ATOMIC);
     if (image->bus_resource.name == NULL) {
       retval = -ENOMEM;
       goto err_name;
     }
   }
   sprintf((char *)image->bus_resource.name, "%s.%d", tsi148_bridge->name, image->number);
   image->bus_resource.start = 0;
   image->bus_resource.end = (unsigned long)size;
   image->bus_resource.flags = IORESOURCE_MEM;
   retval = pci_bus_alloc_resource(pdev->bus, &image->bus_resource, size, 0x10000, PCIBIOS_MIN_MEM, 0, NULL, NULL);
   if (retval) {
     dev_err(tsi148_bridge->parent,
             "Failed to allocate mem "
             "resource for window %d size 0x%lx start 0x%lx\n",
             image->number, (unsigned long)size, (unsigned long)image->bus_resource.start);
     goto err_resource;
   }
   image->kern_base = ioremap_nocache(image->bus_resource.start, size);
   if (image->kern_base == NULL) {
     dev_err(tsi148_bridge->parent, "Failed to remap resource\n");
     retval = -ENOMEM;
     goto err_remap;
   }
   return 0;
 err_remap:
   release_resource(&image->bus_resource);
 err_resource:
   kfree(image->bus_resource.name);
-  memset(&image->bus_resource, 0, sizeof(struct resource));
+  memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 err_name:
   return retval;
 }<sep>@@
expression e1,e2;
type T;
@@

memset (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )
--- initial
+++ final
@@ -1,7 +1,7 @@
 static void tsi148_free_resource(struct vme_master_resource *image) {
   iounmap(image->kern_base);
   image->kern_base = NULL;
   release_resource(&image->bus_resource);
   kfree(image->bus_resource.name);
-  memset(&image->bus_resource, 0, sizeof(struct resource));
+  memset(&image->bus_resource, 0, sizeof(image->bus_resource));
 }<sep>@@
expression e1,e2;
type T;
@@

memset (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )
--- initial
+++ final
@@ -1,30 +1,30 @@
 static int adv7842_command_ram_test(struct v4l2_subdev *sd) {
   struct i2c_client *client = v4l2_get_subdevdata(sd);
   struct adv7842_state *state = to_state(sd);
   struct adv7842_platform_data *pdata = client->dev.platform_data;
   struct v4l2_dv_timings timings;
   int ret = 0;
   if (!pdata) return -ENODEV;
   if (!pdata->sd_ram_size || !pdata->sd_ram_ddr) {
     v4l2_info(sd, "no sdram or no ddr sdram\n");
     return -EINVAL;
   }
   main_reset(sd);
   adv7842_rewrite_i2c_addresses(sd, pdata);
   /* run ram test */
   ret = adv7842_ddr_ram_test(sd);
   main_reset(sd);
   adv7842_rewrite_i2c_addresses(sd, pdata);
   /* and re-init chip and state */
   adv7842_core_init(sd);
   disable_input(sd);
   select_input(sd, state->vid_std_select);
   enable_input(sd);
   edid_write_vga_segment(sd);
   edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_A);
   edid_write_hdmi_segment(sd, ADV7842_EDID_PORT_B);
   timings = state->timings;
-  memset(&state->timings, 0, sizeof(struct v4l2_dv_timings));
+  memset(&state->timings, 0, sizeof(state->timings));
   adv7842_s_dv_timings(sd, &timings);
   return ret;
 }<sep>@@
expression e1,e2;
type T;
@@

memset (&e1,e2,
- sizeof(T)
+ sizeof(e1)
  )
--- initial
+++ final
@@ -1,15 +1,15 @@
 struct dvb_frontend *as102_attach(const char *name, const struct as102_fe_ops *ops, void *priv, uint8_t elna_cfg) {
   struct as102_state *state;
   struct dvb_frontend *fe;
-  state = kzalloc(sizeof(struct as102_state), GFP_KERNEL);
+  state = kzalloc(sizeof(*state), GFP_KERNEL);
   if (!state) return NULL;
   fe = &state->frontend;
   fe->demodulator_priv = state;
   state->ops = ops;
   state->priv = priv;
   state->elna_cfg = elna_cfg;
   /* init frontend callback ops */
   memcpy(&fe->ops, &as102_fe_ops, sizeof(struct dvb_frontend_ops));
   strncpy(fe->ops.info.name, name, sizeof(fe->ops.info.name));
   return fe;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,40 +1,40 @@
 static int isc_formats_init(struct isc_device *isc) {
   struct isc_format *fmt;
   struct v4l2_subdev *subdev = isc->current_subdev->sd;
   unsigned int num_fmts, i, j;
   struct v4l2_subdev_mbus_code_enum mbus_code = {
       .which = V4L2_SUBDEV_FORMAT_ACTIVE,
   };
   fmt = &isc_formats[0];
   for (i = 0; i < ARRAY_SIZE(isc_formats); i++) {
     fmt->isc_support = false;
     fmt->sd_support = false;
     fmt++;
   }
   while (!v4l2_subdev_call(subdev, pad, enum_mbus_code, NULL, &mbus_code)) {
     mbus_code.index++;
     fmt = find_format_by_code(mbus_code.code, &i);
     if (!fmt) continue;
     fmt->sd_support = true;
     if (i <= RAW_FMT_IND_END) {
       for (j = ISC_FMT_IND_START; j <= ISC_FMT_IND_END; j++)
         isc_formats[j].isc_support = true;
       isc->raw_fmt = fmt;
     }
   }
   fmt = &isc_formats[0];
   for (i = 0, num_fmts = 0; i < ARRAY_SIZE(isc_formats); i++) {
     if (fmt->isc_support || fmt->sd_support) num_fmts++;
     fmt++;
   }
   if (!num_fmts) return -ENXIO;
   isc->num_user_formats = num_fmts;
-  isc->user_formats = devm_kcalloc(isc->dev, num_fmts, sizeof(struct isc_format *), GFP_KERNEL);
+  isc->user_formats = devm_kcalloc(isc->dev, num_fmts, sizeof(*isc->user_formats), GFP_KERNEL);
   if (!isc->user_formats) return -ENOMEM;
   fmt = &isc_formats[0];
   for (i = 0, j = 0; i < ARRAY_SIZE(isc_formats); i++) {
     if (fmt->isc_support || fmt->sd_support) isc->user_formats[j++] = fmt;
     fmt++;
   }
   return 0;
 }<sep>@@
expression e1,e2,x,y;
type T;
@@

e1 = devm_kcalloc (x,y,
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,33 +1,33 @@
 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(struct cx24113_state), GFP_KERNEL);
+  struct cx24113_state *state = kzalloc(sizeof(*state), GFP_KERNEL);
   int rc;
   if (!state) goto error;
   /* setup the state */
   state->config = config;
   state->i2c = i2c;
   cx_info("trying to detect myself\n");
   /* making a dummy read, because of some expected troubles
    * after power on */
   cx24113_readreg(state, 0x00);
   rc = cx24113_readreg(state, 0x00);
   if (rc < 0) {
     cx_info("CX24113 not found.\n");
     goto error;
   }
   state->rev = rc;
   switch (rc) {
   case 0x43: cx_info("detected CX24113 variant\n"); break;
   case REV_CX24113: cx_info("successfully detected\n"); break;
   default: cx_err("unsupported device id: %x\n", state->rev); goto error;
   }
   state->ver = cx24113_readreg(state, 0x01);
   cx_info("version: %x\n", state->ver);
   /* create dvb_frontend */
   memcpy(&fe->ops.tuner_ops, &cx24113_tuner_ops, sizeof(struct dvb_tuner_ops));
   fe->tuner_priv = state;
   return fe;
 error:
   kfree(state);
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,24 +1,24 @@
 struct dvb_frontend *cx24116_attach(const struct cx24116_config *config, struct i2c_adapter *i2c) {
   struct cx24116_state *state;
   int ret;
   dprintk("%s\n", __func__);
   /* allocate memory for the internal state */
-  state = kzalloc(sizeof(struct cx24116_state), GFP_KERNEL);
+  state = kzalloc(sizeof(*state), GFP_KERNEL);
   if (state == NULL) goto error1;
   state->config = config;
   state->i2c = i2c;
   /* check if the demod is present */
   ret = (cx24116_readreg(state, 0xFF) << 8) | cx24116_readreg(state, 0xFE);
   if (ret != 0x0501) {
     printk(KERN_INFO "Invalid probe, probably not a CX24116 device\n");
     goto error2;
   }
   /* create dvb_frontend */
   memcpy(&state->frontend.ops, &cx24116_ops, sizeof(struct dvb_frontend_ops));
   state->frontend.demodulator_priv = state;
   return &state->frontend;
 error2:
   kfree(state);
 error1:
   return NULL;
 }<sep>@@
expression e1,e2;
type T;
@@

e1 = kzalloc (
- sizeof(T)
+ sizeof(*e1)
  ,e2)
--- initial
+++ final
@@ -1,42 +1,42 @@
 int cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type) {
   struct hexline *hx;
   int ret, pos = 0;
-  hx = kmalloc(sizeof(struct hexline), GFP_KERNEL);
+  hx = kmalloc(sizeof(*hx), GFP_KERNEL);
   if (!hx) return -ENOMEM;
   /* stop the CPU */
   hx->data[0] = 1;
   ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1);
   if (ret != 1) {
     dev_err(&udev->dev, "%s: CPU stop failed=%d\n", KBUILD_MODNAME, ret);
     ret = -EIO;
     goto err_kfree;
   }
   /* write firmware to memory */
   for (;;) {
     ret = cypress_get_hexline(fw, hx, &pos);
     if (ret < 0)
       goto err_kfree;
     else if (ret == 0)
       break;
     ret = usb_cypress_writemem(udev, hx->addr, hx->data, hx->len);
     if (ret < 0) {
       goto err_kfree;
     } else if (ret != hx->len) {
       dev_err(&udev->dev, "%s: error while transferring firmware (transferred size=%d, block size=%d)\n", KBUILD_MODNAME, ret, hx->len);
       ret = -EIO;
       goto err_kfree;
     }
   }
   /* start the CPU */
   hx->data[0] = 0;
   ret = usb_cypress_writemem(udev, cypress[type].cs_reg, hx->data, 1);
   if (ret != 1) {
     dev_err(&udev->dev, "%s: CPU start failed=%d\n", KBUILD_MODNAME, ret);
     ret = -EIO;
     goto err_kfree;
   }
   ret = 0;
 err_kfree:
   kfree(hx);
   return ret;
 }<sep>@@
expression e1,e2;
type T;
@@

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