imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,27 +1,27 @@
 static int tcm_qla2xxx_write_pending(struct se_cmd *se_cmd) {
   struct qla_tgt_cmd *cmd = container_of(se_cmd, struct qla_tgt_cmd, se_cmd);
   if (cmd->aborted) {
     /* Cmd can loop during Q-full.  tcm_qla2xxx_aborted_task
      * can get ahead of this cmd. tcm_qla2xxx_aborted_task
      * already kick start the free.
      */
     pr_debug("write_pending aborted cmd[%p] refcount %d "
              "transport_state %x, t_state %x, se_cmd_flags %x\n",
-             cmd, cmd->se_cmd.cmd_kref.refcount.counter, cmd->se_cmd.transport_state, cmd->se_cmd.t_state, cmd->se_cmd.se_cmd_flags);
+             cmd, kref_read(&cmd->se_cmd.cmd_kref), cmd->se_cmd.transport_state, cmd->se_cmd.t_state, cmd->se_cmd.se_cmd_flags);
     return 0;
   }
   cmd->cmd_flags |= BIT_3;
   cmd->bufflen = se_cmd->data_length;
   cmd->dma_data_direction = target_reverse_dma_direction(se_cmd);
   cmd->sg_cnt = se_cmd->t_data_nents;
   cmd->sg = se_cmd->t_data_sg;
   cmd->prot_sg_cnt = se_cmd->t_prot_nents;
   cmd->prot_sg = se_cmd->t_prot_sg;
   cmd->blk_sz = se_cmd->se_dev->dev_attrib.block_size;
   se_cmd->pi_err = 0;
   /*
    * qla_target.c:qlt_rdy_to_xfer() will call pci_map_sg() to setup
    * the SGL mappings into PCIe memory for incoming FCP WRITE data.
    */
   return qlt_rdy_to_xfer(cmd);
 }<sep>@@
expression e;
@@
-		e.refcount.counter
+		kref_read(&e)
--- initial
+++ final
@@ -1,16 +1,16 @@
 void lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, uint32_t did) {
   memset(ndlp, 0, sizeof(struct lpfc_nodelist));
   lpfc_initialize_node(vport, ndlp, did);
   INIT_LIST_HEAD(&ndlp->nlp_listp);
   if (vport->phba->sli_rev == LPFC_SLI_REV4) {
     ndlp->nlp_rpi = lpfc_sli4_alloc_rpi(vport->phba);
     lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
                      "0007 rpi:%x DID:%x flg:%x refcnt:%d "
                      "map:%x %p\n",
-                     ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, atomic_read(&ndlp->kref.refcount), ndlp->nlp_usg_map, ndlp);
+                     ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref), ndlp->nlp_usg_map, ndlp);
     ndlp->active_rrqs_xri_bitmap = mempool_alloc(vport->phba->active_rrq_pool, GFP_KERNEL);
     if (ndlp->active_rrqs_xri_bitmap) memset(ndlp->active_rrqs_xri_bitmap, 0, ndlp->phba->cfg_rrq_xri_bitmap_sz);
   }
   lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE, "node init:       did:x%x", ndlp->nlp_DID, 0, 0);
   return;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,5 +1,5 @@
 struct ceph_msg *ceph_msg_get(struct ceph_msg *msg) {
-  dout("%s %p (was %d)\n", __func__, msg, atomic_read(&msg->kref.refcount));
+  dout("%s %p (was %d)\n", __func__, msg, kref_read(&msg->kref));
   kref_get(&msg->kref);
   return msg;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,4 +1,4 @@
 bool comedi_buf_is_mmapped(struct comedi_subdevice *s) {
   struct comedi_buf_map *bm = s->async->buf_map;
-  return bm && (atomic_read(&bm->refcount.refcount) > 1);
+  return bm && (kref_read(&bm->refcount) > 1);
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,43 +1,43 @@
 static int ion_debug_heap_show(struct seq_file *s, void *unused) {
   struct ion_heap *heap = s->private;
   struct ion_device *dev = heap->dev;
   struct rb_node *n;
   size_t total_size = 0;
   size_t total_orphaned_size = 0;
   seq_printf(s, "%16s %16s %16s\n", "client", "pid", "size");
   seq_puts(s, "----------------------------------------------------\n");
   mutex_lock(&debugfs_mutex);
   for (n = rb_first(&dev->clients); n; n = rb_next(n)) {
     struct ion_client *client = rb_entry(n, struct ion_client, node);
     size_t size = ion_debug_heap_total(client, heap->id);
     if (!size) continue;
     if (client->task) {
       char task_comm[TASK_COMM_LEN];
       get_task_comm(task_comm, client->task);
       seq_printf(s, "%16s %16u %16zu\n", task_comm, client->pid, size);
     } else {
       seq_printf(s, "%16s %16u %16zu\n", client->name, client->pid, size);
     }
   }
   mutex_unlock(&debugfs_mutex);
   seq_puts(s, "----------------------------------------------------\n");
   seq_puts(s, "orphaned allocations (info is from last known client):\n");
   mutex_lock(&dev->buffer_lock);
   for (n = rb_first(&dev->buffers); n; n = rb_next(n)) {
     struct ion_buffer *buffer = rb_entry(n, struct ion_buffer, node);
     if (buffer->heap->id != heap->id) continue;
     total_size += buffer->size;
     if (!buffer->handle_count) {
-      seq_printf(s, "%16s %16u %16zu %d %d\n", buffer->task_comm, buffer->pid, buffer->size, buffer->kmap_cnt, atomic_read(&buffer->ref.refcount));
+      seq_printf(s, "%16s %16u %16zu %d %d\n", buffer->task_comm, buffer->pid, buffer->size, buffer->kmap_cnt, kref_read(&buffer->ref));
       total_orphaned_size += buffer->size;
     }
   }
   mutex_unlock(&dev->buffer_lock);
   seq_puts(s, "----------------------------------------------------\n");
   seq_printf(s, "%16s %16zu\n", "total orphaned", total_orphaned_size);
   seq_printf(s, "%16s %16zu\n", "total ", total_size);
   if (heap->flags & ION_HEAP_FLAG_DEFER_FREE) seq_printf(s, "%16s %16zu\n", "deferred free", heap->free_list_size);
   seq_puts(s, "----------------------------------------------------\n");
   if (heap->debug_show) heap->debug_show(heap, s, unused);
   return 0;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,62 +1,62 @@
 void lpfc_mbx_cmpl_ns_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb) {
   MAILBOX_t *mb = &pmb->u.mb;
   struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *)(pmb->context1);
   struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *)pmb->context2;
   struct lpfc_vport *vport = pmb->vport;
   pmb->context1 = NULL;
   pmb->context2 = NULL;
   if (mb->mbxStatus) {
   out:
     lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS, "0260 Register NameServer error: 0x%x\n", mb->mbxStatus);
     /* decrement the node reference count held for this
      * callback function.
      */
     lpfc_nlp_put(ndlp);
     lpfc_mbuf_free(phba, mp->virt, mp->phys);
     kfree(mp);
     mempool_free(pmb, phba->mbox_mem_pool);
     /* If no other thread is using the ndlp, free it */
     lpfc_nlp_not_used(ndlp);
     if (phba->fc_topology == LPFC_TOPOLOGY_LOOP) {
       /*
        * RegLogin failed, use loop map to make discovery
        * list
        */
       lpfc_disc_list_loopmap(vport);
       /* Start discovery */
       lpfc_disc_start(vport);
       return;
     }
     lpfc_vport_set_state(vport, FC_VPORT_FAILED);
     return;
   }
   if (phba->sli_rev < LPFC_SLI_REV4) ndlp->nlp_rpi = mb->un.varWords[0];
   ndlp->nlp_flag |= NLP_RPI_REGISTERED;
   ndlp->nlp_type |= NLP_FABRIC;
   lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNMAPPED_NODE);
-  lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, "0003 rpi:%x DID:%x flg:%x %d map%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, atomic_read(&ndlp->kref.refcount), ndlp->nlp_usg_map, ndlp);
+  lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI, "0003 rpi:%x DID:%x flg:%x %d map%x %p\n", ndlp->nlp_rpi, ndlp->nlp_DID, ndlp->nlp_flag, kref_read(&ndlp->kref), ndlp->nlp_usg_map, ndlp);
   if (vport->port_state < LPFC_VPORT_READY) {
     /* Link up discovery requires Fabric registration. */
     lpfc_ns_cmd(vport, SLI_CTNS_RNN_ID, 0, 0);
     lpfc_ns_cmd(vport, SLI_CTNS_RSNN_NN, 0, 0);
     lpfc_ns_cmd(vport, SLI_CTNS_RSPN_ID, 0, 0);
     lpfc_ns_cmd(vport, SLI_CTNS_RFT_ID, 0, 0);
     lpfc_ns_cmd(vport, SLI_CTNS_RFF_ID, 0, 0);
     /* Issue SCR just before NameServer GID_FT Query */
     lpfc_issue_els_scr(vport, SCR_DID, 0);
   }
   vport->fc_ns_retry = 0;
   /* Good status, issue CT Request to NameServer */
   if (lpfc_ns_cmd(vport, SLI_CTNS_GID_FT, 0, 0)) {
     /* Cannot issue NameServer Query, so finish up discovery */
     goto out;
   }
   /* decrement the node reference count held for this
    * callback function.
    */
   lpfc_nlp_put(ndlp);
   lpfc_mbuf_free(phba, mp->virt, mp->phys);
   kfree(mp);
   mempool_free(pmb, phba->mbox_mem_pool);
   return;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,20 +1,20 @@
 static void etnaviv_gem_describe(struct drm_gem_object *obj, struct seq_file *m) {
   struct etnaviv_gem_object *etnaviv_obj = to_etnaviv_bo(obj);
   struct reservation_object *robj = etnaviv_obj->resv;
   struct reservation_object_list *fobj;
   struct dma_fence *fence;
   unsigned long off = drm_vma_node_start(&obj->vma_node);
-  seq_printf(m, "%08x: %c %2d (%2d) %08lx %p %zd\n", etnaviv_obj->flags, is_active(etnaviv_obj) ? 'A' : 'I', obj->name, obj->refcount.refcount.counter, off, etnaviv_obj->vaddr, obj->size);
+  seq_printf(m, "%08x: %c %2d (%2d) %08lx %p %zd\n", etnaviv_obj->flags, is_active(etnaviv_obj) ? 'A' : 'I', obj->name, kref_read(&obj->refcount), off, etnaviv_obj->vaddr, obj->size);
   rcu_read_lock();
   fobj = rcu_dereference(robj->fence);
   if (fobj) {
     unsigned int i, shared_count = fobj->shared_count;
     for (i = 0; i < shared_count; i++) {
       fence = rcu_dereference(fobj->shared[i]);
       etnaviv_gem_describe_fence(fence, "Shared", m);
     }
   }
   fence = rcu_dereference(robj->fence_excl);
   if (fence) etnaviv_gem_describe_fence(fence, "Exclusive", m);
   rcu_read_unlock();
 }<sep>@@
expression e;
@@
-		e.refcount.counter
+		kref_read(&e)
--- initial
+++ final
@@ -1,14 +1,14 @@
 static int c_show(struct seq_file *m, void *p) {
   struct cache_head *cp = p;
   struct cache_detail *cd = m->private;
   if (p == SEQ_START_TOKEN) return cd->cache_show(m, cd, NULL);
-  ifdebug(CACHE) seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", convert_to_wallclock(cp->expiry_time), atomic_read(&cp->ref.refcount), cp->flags);
+  ifdebug(CACHE) seq_printf(m, "# expiry=%ld refcnt=%d flags=%lx\n", convert_to_wallclock(cp->expiry_time), kref_read(&cp->ref), cp->flags);
   cache_get(cp);
   if (cache_check(cd, cp, NULL)) /* cache_check does a cache_put on failure */
     seq_printf(m, "# ");
   else {
     if (cache_is_expired(cd, cp)) seq_printf(m, "# ");
     cache_put(cp, cd);
   }
   return cd->cache_show(m, cd, cp);
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,15 +1,15 @@
 static struct svc_xprt *svc_xprt_dequeue(struct svc_pool *pool) {
   struct svc_xprt *xprt = NULL;
   if (list_empty(&pool->sp_sockets)) goto out;
   spin_lock_bh(&pool->sp_lock);
   if (likely(!list_empty(&pool->sp_sockets))) {
     xprt = list_first_entry(&pool->sp_sockets, struct svc_xprt, xpt_ready);
     list_del_init(&xprt->xpt_ready);
     svc_xprt_get(xprt);
-    dprintk("svc: transport %p dequeued, inuse=%d\n", xprt, atomic_read(&xprt->xpt_ref.refcount));
+    dprintk("svc: transport %p dequeued, inuse=%d\n", xprt, kref_read(&xprt->xpt_ref));
   }
   spin_unlock_bh(&pool->sp_lock);
 out:
   trace_svc_xprt_dequeue(xprt);
   return xprt;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,24 +1,24 @@
 static void lpfc_nlp_release(struct kref *kref) {
   struct lpfc_hba *phba;
   unsigned long flags;
   struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist, kref);
   lpfc_debugfs_disc_trc(ndlp->vport, LPFC_DISC_TRC_NODE, "node release:    did:x%x flg:x%x type:x%x", ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_type);
   lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_NODE,
                    "0279 lpfc_nlp_release: ndlp:x%p did %x "
                    "usgmap:x%x refcnt:%d rpi:%x\n",
-                   (void *)ndlp, ndlp->nlp_DID, ndlp->nlp_usg_map, atomic_read(&ndlp->kref.refcount), ndlp->nlp_rpi);
+                   (void *)ndlp, ndlp->nlp_DID, ndlp->nlp_usg_map, kref_read(&ndlp->kref), ndlp->nlp_rpi);
   /* remove ndlp from action. */
   lpfc_nlp_remove(ndlp->vport, ndlp);
   /* clear the ndlp active flag for all release cases */
   phba = ndlp->phba;
   spin_lock_irqsave(&phba->ndlp_lock, flags);
   NLP_CLR_NODE_ACT(ndlp);
   spin_unlock_irqrestore(&phba->ndlp_lock, flags);
   if (phba->sli_rev == LPFC_SLI_REV4) lpfc_sli4_free_rpi(phba, ndlp->nlp_rpi);
   /* free ndlp memory for final ndlp release */
   if (NLP_CHK_FREE_REQ(ndlp)) {
     kfree(ndlp->lat_data);
     if (phba->sli_rev == LPFC_SLI_REV4) mempool_free(ndlp->active_rrqs_xri_bitmap, ndlp->phba->active_rrq_pool);
     mempool_free(ndlp, ndlp->phba->nlp_mem_pool);
   }
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,48 +1,48 @@
 static int lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size) {
   int len = 0;
   int cnt;
   struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
   struct lpfc_nodelist *ndlp;
   unsigned char *statep, *name;
   cnt = (LPFC_NODELIST_SIZE / LPFC_NODELIST_ENTRY_SIZE);
   spin_lock_irq(shost->host_lock);
   list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp) {
     if (!cnt) {
       len += snprintf(buf + len, size - len, "Missing Nodelist Entries\n");
       break;
     }
     cnt--;
     switch (ndlp->nlp_state) {
     case NLP_STE_UNUSED_NODE: statep = "UNUSED"; break;
     case NLP_STE_PLOGI_ISSUE: statep = "PLOGI "; break;
     case NLP_STE_ADISC_ISSUE: statep = "ADISC "; break;
     case NLP_STE_REG_LOGIN_ISSUE: statep = "REGLOG"; break;
     case NLP_STE_PRLI_ISSUE: statep = "PRLI  "; break;
     case NLP_STE_LOGO_ISSUE: statep = "LOGO  "; break;
     case NLP_STE_UNMAPPED_NODE: statep = "UNMAP "; break;
     case NLP_STE_MAPPED_NODE: statep = "MAPPED"; break;
     case NLP_STE_NPR_NODE: statep = "NPR   "; break;
     default: statep = "UNKNOWN";
     }
     len += snprintf(buf + len, size - len, "%s DID:x%06x ", statep, ndlp->nlp_DID);
     name = (unsigned char *)&ndlp->nlp_portname;
     len += snprintf(buf + len, size - len, "WWPN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4), *(name + 5), *(name + 6), *(name + 7));
     name = (unsigned char *)&ndlp->nlp_nodename;
     len += snprintf(buf + len, size - len, "WWNN %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x ", *name, *(name + 1), *(name + 2), *(name + 3), *(name + 4), *(name + 5), *(name + 6), *(name + 7));
     if (ndlp->nlp_flag & NLP_RPI_REGISTERED)
       len += snprintf(buf + len, size - len, "RPI:%03d ", ndlp->nlp_rpi);
     else
       len += snprintf(buf + len, size - len, "RPI:none ");
     len += snprintf(buf + len, size - len, "flag:x%08x ", ndlp->nlp_flag);
     if (!ndlp->nlp_type) len += snprintf(buf + len, size - len, "UNKNOWN_TYPE ");
     if (ndlp->nlp_type & NLP_FC_NODE) len += snprintf(buf + len, size - len, "FC_NODE ");
     if (ndlp->nlp_type & NLP_FABRIC) len += snprintf(buf + len, size - len, "FABRIC ");
     if (ndlp->nlp_type & NLP_FCP_TARGET) len += snprintf(buf + len, size - len, "FCP_TGT sid:%d ", ndlp->nlp_sid);
     if (ndlp->nlp_type & NLP_FCP_INITIATOR) len += snprintf(buf + len, size - len, "FCP_INITIATOR ");
     len += snprintf(buf + len, size - len, "usgmap:%x ", ndlp->nlp_usg_map);
-    len += snprintf(buf + len, size - len, "refcnt:%x", atomic_read(&ndlp->kref.refcount));
+    len += snprintf(buf + len, size - len, "refcnt:%x", kref_read(&ndlp->kref));
     len += snprintf(buf + len, size - len, "\n");
   }
   spin_unlock_irq(shost->host_lock);
   return len;
 }<sep>@@
expression e; 
@@
-               atomic_read(&e.refcount)
+               kref_read(&e)
--- initial
+++ final
@@ -1,25 +1,22 @@
 static int tz1090_pdc_pinctrl_probe(struct platform_device *pdev) {
   struct tz1090_pdc_pmx *pmx;
   struct resource *res;
   pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
-  if (!pmx) {
-    dev_err(&pdev->dev, "Can't alloc tz1090_pdc_pmx\n");
-    return -ENOMEM;
-  }
+  if (!pmx) return -ENOMEM;
   pmx->dev = &pdev->dev;
   spin_lock_init(&pmx->lock);
   tz1090_pdc_pinctrl_desc.name = dev_name(&pdev->dev);
   tz1090_pdc_pinctrl_desc.pins = tz1090_pdc_pins;
   tz1090_pdc_pinctrl_desc.npins = ARRAY_SIZE(tz1090_pdc_pins);
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   pmx->regs = devm_ioremap_resource(&pdev->dev, res);
   if (IS_ERR(pmx->regs)) return PTR_ERR(pmx->regs);
   pmx->pctl = devm_pinctrl_register(&pdev->dev, &tz1090_pdc_pinctrl_desc, pmx);
   if (IS_ERR(pmx->pctl)) {
     dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
     return PTR_ERR(pmx->pctl);
   }
   platform_set_drvdata(pdev, pmx);
   dev_info(&pdev->dev, "TZ1090 PDC pinctrl driver initialised\n");
   return 0;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@

x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
	\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
	\|rhashtable_lookup_fast\)
      (...);
if (x == NULL)
- {
- f(...,c,...);
  S1
- }
 else S2
--- initial
+++ final
@@ -1,62 +1,59 @@
 static int cs42l73_i2c_probe(struct i2c_client *i2c_client, const struct i2c_device_id *id) {
   struct cs42l73_private *cs42l73;
   struct cs42l73_platform_data *pdata = dev_get_platdata(&i2c_client->dev);
   int ret;
   unsigned int devid = 0;
   unsigned int reg;
   u32 val32;
   cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private), GFP_KERNEL);
   if (!cs42l73) return -ENOMEM;
   cs42l73->regmap = devm_regmap_init_i2c(i2c_client, &cs42l73_regmap);
   if (IS_ERR(cs42l73->regmap)) {
     ret = PTR_ERR(cs42l73->regmap);
     dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
     return ret;
   }
   if (pdata) {
     cs42l73->pdata = *pdata;
   } else {
     pdata = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_platform_data), GFP_KERNEL);
-    if (!pdata) {
-      dev_err(&i2c_client->dev, "could not allocate pdata\n");
-      return -ENOMEM;
-    }
+    if (!pdata) return -ENOMEM;
     if (i2c_client->dev.of_node) {
       if (of_property_read_u32(i2c_client->dev.of_node, "chgfreq", &val32) >= 0) pdata->chgfreq = val32;
     }
     pdata->reset_gpio = of_get_named_gpio(i2c_client->dev.of_node, "reset-gpio", 0);
     cs42l73->pdata = *pdata;
   }
   i2c_set_clientdata(i2c_client, cs42l73);
   if (cs42l73->pdata.reset_gpio) {
     ret = devm_gpio_request_one(&i2c_client->dev, cs42l73->pdata.reset_gpio, GPIOF_OUT_INIT_HIGH, "CS42L73 /RST");
     if (ret < 0) {
       dev_err(&i2c_client->dev, "Failed to request /RST %d: %d\n", cs42l73->pdata.reset_gpio, ret);
       return ret;
     }
     gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 0);
     gpio_set_value_cansleep(cs42l73->pdata.reset_gpio, 1);
   }
   /* initialize codec */
   ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, &reg);
   devid = (reg & 0xFF) << 12;
   ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, &reg);
   devid |= (reg & 0xFF) << 4;
   ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, &reg);
   devid |= (reg & 0xF0) >> 4;
   if (devid != CS42L73_DEVID) {
     ret = -ENODEV;
     dev_err(&i2c_client->dev, "CS42L73 Device ID (%X). Expected %X\n", devid, CS42L73_DEVID);
     return ret;
   }
   ret = regmap_read(cs42l73->regmap, CS42L73_REVID, &reg);
   if (ret < 0) {
     dev_err(&i2c_client->dev, "Get Revision ID failed\n");
     return ret;
     ;
   }
   dev_info(&i2c_client->dev, "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF);
   ret = snd_soc_register_codec(&i2c_client->dev, &soc_codec_dev_cs42l73, cs42l73_dai, ARRAY_SIZE(cs42l73_dai));
   if (ret < 0) return ret;
   return 0;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@

x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
	\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
	\|rhashtable_lookup_fast\)
      (...);
if (x == NULL)
- {
- f(...,c,...);
  S1
- }
 else S2
--- initial
+++ final
@@ -1,42 +1,39 @@
 static int palmas_pinctrl_probe(struct platform_device *pdev) {
   struct palmas_pctrl_chip_info *pci;
   const struct palmas_pinctrl_data *pinctrl_data = &tps65913_pinctrl_data;
   int ret;
   bool enable_dvfs1 = false;
   bool enable_dvfs2 = false;
   if (pdev->dev.of_node) {
     pinctrl_data = of_device_get_match_data(&pdev->dev);
     enable_dvfs1 = of_property_read_bool(pdev->dev.of_node, "ti,palmas-enable-dvfs1");
     enable_dvfs2 = of_property_read_bool(pdev->dev.of_node, "ti,palmas-enable-dvfs2");
   }
   pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL);
-  if (!pci) {
-    dev_err(&pdev->dev, "Malloc for pci failed\n");
-    return -ENOMEM;
-  }
+  if (!pci) return -ENOMEM;
   pci->dev = &pdev->dev;
   pci->palmas = dev_get_drvdata(pdev->dev.parent);
   pci->pins = palmas_pins_desc;
   pci->num_pins = ARRAY_SIZE(palmas_pins_desc);
   pci->functions = palmas_pin_function;
   pci->num_functions = ARRAY_SIZE(palmas_pin_function);
   pci->pin_groups = pinctrl_data->pin_groups;
   pci->num_pin_groups = pinctrl_data->num_pin_groups;
   platform_set_drvdata(pdev, pci);
   palmas_pinctrl_set_dvfs1(pci, enable_dvfs1);
   palmas_pinctrl_set_dvfs2(pci, enable_dvfs2);
   ret = palmas_pinctrl_get_pin_mux(pci);
   if (ret < 0) {
     dev_err(&pdev->dev, "Reading pinctrol option register failed: %d\n", ret);
     return ret;
   }
   palmas_pinctrl_desc.name = dev_name(&pdev->dev);
   palmas_pinctrl_desc.pins = palmas_pins_desc;
   palmas_pinctrl_desc.npins = ARRAY_SIZE(palmas_pins_desc);
   pci->pctl = devm_pinctrl_register(&pdev->dev, &palmas_pinctrl_desc, pci);
   if (IS_ERR(pci->pctl)) {
     dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
     return PTR_ERR(pci->pctl);
   }
   return 0;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@

x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
	\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
	\|rhashtable_lookup_fast\)
      (...);
if (x == NULL)
- {
- f(...,c,...);
  S1
- }
 else S2
--- initial
+++ final
@@ -1,15 +1,12 @@
 int pinctrl_utils_add_map_configs(struct pinctrl_dev *pctldev, struct pinctrl_map **map, unsigned *reserved_maps, unsigned *num_maps, const char *group, unsigned long *configs, unsigned num_configs, enum pinctrl_map_type type) {
   unsigned long *dup_configs;
   if (WARN_ON(*num_maps == *reserved_maps)) return -ENOSPC;
   dup_configs = kmemdup(configs, num_configs * sizeof(*dup_configs), GFP_KERNEL);
-  if (!dup_configs) {
-    dev_err(pctldev->dev, "kmemdup(configs) failed\n");
-    return -ENOMEM;
-  }
+  if (!dup_configs) return -ENOMEM;
   (*map)[*num_maps].type = type;
   (*map)[*num_maps].data.configs.group_or_pin = group;
   (*map)[*num_maps].data.configs.configs = dup_configs;
   (*map)[*num_maps].data.configs.num_configs = num_configs;
   (*num_maps)++;
   return 0;
 }<sep>@@
expression x;
identifier f;
constant char[] c;
statement S1,S2;
@@

x = \(kmalloc\|kcalloc\|kzalloc\|devm_kmalloc\|devm_kcalloc\|devm_kzalloc
	\|kmemdup\|kmem_cache_alloc\|kmem_cache_zalloc
	\|rhashtable_lookup_fast\)
      (...);
if (x == NULL)
- {
- f(...,c,...);
  S1
- }
 else S2