imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,63 +1,62 @@
 static int s5p_aes_probe(struct platform_device *pdev) {
   int i, j, err = -ENODEV;
   struct s5p_aes_dev *pdata;
   struct device *dev = &pdev->dev;
   struct resource *res;
   if (s5p_dev) return -EEXIST;
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) return -ENODEV;
   pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
   if (!pdata) return -ENOMEM;
   if (!devm_request_mem_region(dev, res->start, resource_size(res), pdev->name)) return -EBUSY;
   pdata->clk = devm_clk_get(dev, "secss");
   if (IS_ERR(pdata->clk)) {
     dev_err(dev, "failed to find secss clock source\n");
     return -ENOENT;
   }
   clk_enable(pdata->clk);
   spin_lock_init(&pdata->lock);
   pdata->ioaddr = devm_ioremap(dev, res->start, resource_size(res));
   pdata->irq_hash = platform_get_irq_byname(pdev, "hash");
   if (pdata->irq_hash < 0) {
     err = pdata->irq_hash;
     dev_warn(dev, "hash interrupt is not available.\n");
     goto err_irq;
   }
   err = devm_request_irq(dev, pdata->irq_hash, s5p_aes_interrupt, IRQF_SHARED, pdev->name, pdev);
   if (err < 0) {
     dev_warn(dev, "hash interrupt is not available.\n");
     goto err_irq;
   }
   pdata->irq_fc = platform_get_irq_byname(pdev, "feed control");
   if (pdata->irq_fc < 0) {
     err = pdata->irq_fc;
     dev_warn(dev, "feed control interrupt is not available.\n");
     goto err_irq;
   }
   err = devm_request_irq(dev, pdata->irq_fc, s5p_aes_interrupt, IRQF_SHARED, pdev->name, pdev);
   if (err < 0) {
     dev_warn(dev, "feed control interrupt is not available.\n");
     goto err_irq;
   }
   pdata->dev = dev;
   platform_set_drvdata(pdev, pdata);
   s5p_dev = pdata;
   tasklet_init(&pdata->tasklet, s5p_tasklet_cb, (unsigned long)pdata);
   crypto_init_queue(&pdata->queue, CRYPTO_QUEUE_LEN);
   for (i = 0; i < ARRAY_SIZE(algs); i++) {
     err = crypto_register_alg(&algs[i]);
     if (err) goto err_algs;
   }
   pr_info("s5p-sss driver registered\n");
   return 0;
 err_algs:
   dev_err(dev, "can't register '%s': %d\n", algs[i].cra_name, err);
   for (j = 0; j < i; j++)
     crypto_unregister_alg(&algs[j]);
   tasklet_kill(&pdata->tasklet);
 err_irq:
   clk_disable(pdata->clk);
   s5p_dev = NULL;
-  platform_set_drvdata(pdev, NULL);
   return err;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,67 +1,66 @@
 static int ath79_spi_probe(struct platform_device *pdev) {
   struct spi_master *master;
   struct ath79_spi *sp;
   struct ath79_spi_platform_data *pdata;
   struct resource *r;
   unsigned long rate;
   int ret;
   master = spi_alloc_master(&pdev->dev, sizeof(*sp));
   if (master == NULL) {
     dev_err(&pdev->dev, "failed to allocate spi master\n");
     return -ENOMEM;
   }
   sp = spi_master_get_devdata(master);
   platform_set_drvdata(pdev, sp);
   pdata = pdev->dev.platform_data;
   master->setup = ath79_spi_setup;
   master->cleanup = ath79_spi_cleanup;
   if (pdata) {
     master->bus_num = pdata->bus_num;
     master->num_chipselect = pdata->num_chipselect;
   }
   sp->bitbang.master = spi_master_get(master);
   sp->bitbang.chipselect = ath79_spi_chipselect;
   sp->bitbang.txrx_word[SPI_MODE_0] = ath79_spi_txrx_mode0;
   sp->bitbang.setup_transfer = spi_bitbang_setup_transfer;
   sp->bitbang.flags = SPI_CS_HIGH;
   r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (r == NULL) {
     ret = -ENOENT;
     goto err_put_master;
   }
   sp->base = ioremap(r->start, resource_size(r));
   if (!sp->base) {
     ret = -ENXIO;
     goto err_put_master;
   }
   sp->clk = clk_get(&pdev->dev, "ahb");
   if (IS_ERR(sp->clk)) {
     ret = PTR_ERR(sp->clk);
     goto err_unmap;
   }
   ret = clk_enable(sp->clk);
   if (ret) goto err_clk_put;
   rate = DIV_ROUND_UP(clk_get_rate(sp->clk), MHZ);
   if (!rate) {
     ret = -EINVAL;
     goto err_clk_disable;
   }
   sp->rrw_delay = ATH79_SPI_RRW_DELAY_FACTOR / rate;
   dev_dbg(&pdev->dev, "register read/write delay is %u nsecs\n", sp->rrw_delay);
   ath79_spi_enable(sp);
   ret = spi_bitbang_start(&sp->bitbang);
   if (ret) goto err_disable;
   return 0;
 err_disable:
   ath79_spi_disable(sp);
 err_clk_disable:
   clk_disable(sp->clk);
 err_clk_put:
   clk_put(sp->clk);
 err_unmap:
   iounmap(sp->base);
 err_put_master:
-  platform_set_drvdata(pdev, NULL);
   spi_master_put(sp->bitbang.master);
   return ret;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,9 +1,8 @@
 static int sudmac_remove(struct platform_device *pdev) {
   struct sudmac_device *su_dev = platform_get_drvdata(pdev);
   struct dma_device *dma_dev = &su_dev->shdma_dev.dma_dev;
   dma_async_device_unregister(dma_dev);
   sudmac_chan_remove(su_dev);
   shdma_cleanup(&su_dev->shdma_dev);
-  platform_set_drvdata(pdev, NULL);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,4 +1 @@
-static void snd_intel8x0_remove(struct pci_dev *pci) {
-  snd_card_free(pci_get_drvdata(pci));
-  pci_set_drvdata(pci, NULL);
-}
+static void snd_intel8x0_remove(struct pci_dev *pci) { snd_card_free(pci_get_drvdata(pci)); }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,12 +1,11 @@
 static int sh_irda_remove(struct platform_device *pdev) {
   struct net_device *ndev = platform_get_drvdata(pdev);
   struct sh_irda_self *self = netdev_priv(ndev);
   if (!self) return 0;
   unregister_netdev(ndev);
   pm_runtime_disable(&pdev->dev);
   sh_irda_remove_iobuf(self);
   iounmap(self->membase);
   free_netdev(ndev);
-  platform_set_drvdata(pdev, NULL);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,63 +1,62 @@
 static void lpfc_pci_remove_one_s3(struct pci_dev *pdev) {
   struct Scsi_Host *shost = pci_get_drvdata(pdev);
   struct lpfc_vport *vport = (struct lpfc_vport *)shost->hostdata;
   struct lpfc_vport **vports;
   struct lpfc_hba *phba = vport->phba;
   int i;
   int bars = pci_select_bars(pdev, IORESOURCE_MEM);
   spin_lock_irq(&phba->hbalock);
   vport->load_flag |= FC_UNLOADING;
   spin_unlock_irq(&phba->hbalock);
   lpfc_free_sysfs_attr(vport);
   /* Release all the vports against this physical port */
   vports = lpfc_create_vport_work_array(phba);
   if (vports != NULL)
     for (i = 0; i <= phba->max_vports && vports[i] != NULL; i++) {
       if (vports[i]->port_type == LPFC_PHYSICAL_PORT) continue;
       fc_vport_terminate(vports[i]->fc_vport);
     }
   lpfc_destroy_vport_work_array(phba, vports);
   /* Remove FC host and then SCSI host with the physical port */
   fc_remove_host(shost);
   scsi_remove_host(shost);
   lpfc_cleanup(vport);
   /*
    * Bring down the SLI Layer. This step disable all interrupts,
    * clears the rings, discards all mailbox commands, and resets
    * the HBA.
    */
   /* HBA interrupt will be disabled after this call */
   lpfc_sli_hba_down(phba);
   /* Stop kthread signal shall trigger work_done one more time */
   kthread_stop(phba->worker_thread);
   /* Final cleanup of txcmplq and reset the HBA */
   lpfc_sli_brdrestart(phba);
   kfree(phba->vpi_bmask);
   kfree(phba->vpi_ids);
   lpfc_stop_hba_timers(phba);
   spin_lock_irq(&phba->hbalock);
   list_del_init(&vport->listentry);
   spin_unlock_irq(&phba->hbalock);
   lpfc_debugfs_terminate(vport);
   /* Disable SR-IOV if enabled */
   if (phba->cfg_sriov_nr_virtfn) pci_disable_sriov(pdev);
   /* Disable interrupt */
   lpfc_sli_disable_intr(phba);
-  pci_set_drvdata(pdev, NULL);
   scsi_host_put(shost);
   /*
    * Call scsi_free before mem_free since scsi bufs are released to their
    * corresponding pools here.
    */
   lpfc_scsi_free(phba);
   lpfc_mem_free_all(phba);
   dma_free_coherent(&pdev->dev, lpfc_sli_hbq_size(), phba->hbqslimp.virt, phba->hbqslimp.phys);
   /* Free resources associated with SLI2 interface */
   dma_free_coherent(&pdev->dev, SLI2_SLIM_SIZE, phba->slim2p.virt, phba->slim2p.phys);
   /* unmap adapter SLIM and Control Registers */
   iounmap(phba->ctrl_regs_memmap_p);
   iounmap(phba->slim_memmap_p);
   lpfc_hba_free(phba);
   pci_release_selected_regions(pdev, bars);
   pci_disable_device(pdev);
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,13 +1,12 @@
 static int pxa27x_keypad_remove(struct platform_device *pdev) {
   struct pxa27x_keypad *keypad = platform_get_drvdata(pdev);
   struct resource *res;
   free_irq(keypad->irq, pdev);
   clk_put(keypad->clk);
   input_unregister_device(keypad->input_dev);
   iounmap(keypad->mmio_base);
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   release_mem_region(res->start, resource_size(res));
-  platform_set_drvdata(pdev, NULL);
   kfree(keypad);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,9 +1,8 @@
 static int __exit cleanup_docg4(struct platform_device *pdev) {
   struct docg4_priv *doc = platform_get_drvdata(pdev);
   nand_release(doc->mtd);
-  platform_set_drvdata(pdev, NULL);
   free_bch(doc->bch);
   kfree(doc->mtd);
   iounmap(doc->virtadr);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,31 +1,30 @@
 static int w5300_probe(struct platform_device *pdev) {
   struct w5300_priv *priv;
   struct net_device *ndev;
   int err;
   ndev = alloc_etherdev(sizeof(*priv));
   if (!ndev) return -ENOMEM;
   SET_NETDEV_DEV(ndev, &pdev->dev);
   platform_set_drvdata(pdev, ndev);
   priv = netdev_priv(ndev);
   priv->ndev = ndev;
   ether_setup(ndev);
   ndev->netdev_ops = &w5300_netdev_ops;
   ndev->ethtool_ops = &w5300_ethtool_ops;
   ndev->watchdog_timeo = HZ;
   netif_napi_add(ndev, &priv->napi, w5300_napi_poll, 16);
   /* This chip doesn't support VLAN packets with normal MTU,
    * so disable VLAN for this device.
    */
   ndev->features |= NETIF_F_VLAN_CHALLENGED;
   err = register_netdev(ndev);
   if (err < 0) goto err_register;
   err = w5300_hw_probe(pdev);
   if (err < 0) goto err_hw_probe;
   return 0;
 err_hw_probe:
   unregister_netdev(ndev);
 err_register:
   free_netdev(ndev);
-  platform_set_drvdata(pdev, NULL);
   return err;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,56 +1,55 @@
 static int __init at32_wdt_probe(struct platform_device *pdev) {
   struct resource *regs;
   int ret;
   if (wdt) {
     dev_dbg(&pdev->dev, "only 1 wdt instance supported.\n");
     return -EBUSY;
   }
   regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!regs) {
     dev_dbg(&pdev->dev, "missing mmio resource\n");
     return -ENXIO;
   }
   wdt = devm_kzalloc(&pdev->dev, sizeof(struct wdt_at32ap700x), GFP_KERNEL);
   if (!wdt) {
     dev_dbg(&pdev->dev, "no memory for wdt structure\n");
     return -ENOMEM;
   }
   wdt->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
   if (!wdt->regs) {
     ret = -ENOMEM;
     dev_dbg(&pdev->dev, "could not map I/O memory\n");
     goto err_free;
   }
   spin_lock_init(&wdt->io_lock);
   wdt->boot_status = at32_wdt_get_status();
   /* Work-around for watchdog silicon errata. */
   if (wdt->boot_status & WDIOF_CARDRESET) {
     dev_info(&pdev->dev, "CPU must be reset with external "
                          "reset or POR due to silicon errata.\n");
     ret = -EIO;
     goto err_free;
   } else {
     wdt->users = 0;
   }
   wdt->miscdev.minor = WATCHDOG_MINOR;
   wdt->miscdev.name = "watchdog";
   wdt->miscdev.fops = &at32_wdt_fops;
   wdt->miscdev.parent = &pdev->dev;
   platform_set_drvdata(pdev, wdt);
   if (at32_wdt_settimeout(timeout)) {
     at32_wdt_settimeout(TIMEOUT_DEFAULT);
     dev_dbg(&pdev->dev, "default timeout invalid, set to %d sec.\n", TIMEOUT_DEFAULT);
   }
   ret = misc_register(&wdt->miscdev);
   if (ret) {
     dev_dbg(&pdev->dev, "failed to register wdt miscdev\n");
     goto err_register;
   }
   dev_info(&pdev->dev, "AT32AP700X WDT at 0x%p, timeout %d sec (nowayout=%d)\n", wdt->regs, wdt->timeout, nowayout);
   return 0;
 err_register:
-  platform_set_drvdata(pdev, NULL);
 err_free:
   wdt = NULL;
   return ret;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,28 +1,23 @@
 static void savagefb_remove(struct pci_dev *dev) {
   struct fb_info *info = pci_get_drvdata(dev);
   DBG("savagefb_remove");
   if (info) {
     /*
      * If unregister_framebuffer fails, then
      * we will be leaving hooks that could cause
      * oopsen laying around.
      */
     if (unregister_framebuffer(info))
       printk(KERN_WARNING "savagefb: danger danger! "
                           "Oopsen imminent!\n");
 #ifdef CONFIG_FB_SAVAGE_I2C
     savagefb_delete_i2c_busses(info);
 #endif
     fb_alloc_cmap(&info->cmap, 0, 0);
     savage_unmap_video(info);
     savage_unmap_mmio(info);
     kfree(info->pixmap.addr);
     pci_release_regions(dev);
     framebuffer_release(info);
-    /*
-     * Ensure that the driver data is no longer
-     * valid.
-     */
-    pci_set_drvdata(dev, NULL);
   }
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,6 +1,5 @@
 static void snd_azf3328_remove(struct pci_dev *pci) {
   snd_azf3328_dbgcallenter();
   snd_card_free(pci_get_drvdata(pci));
-  pci_set_drvdata(pci, NULL);
   snd_azf3328_dbgcallleave();
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,17 +1,16 @@
 static void csio_remove_one(struct pci_dev *pdev) {
   struct csio_hw *hw = pci_get_drvdata(pdev);
   int bars = pci_select_bars(pdev, IORESOURCE_MEM);
   csio_lnodes_block_request(hw);
   spin_lock_irq(&hw->lock);
   /* Stops lnode, Rnode s/m
    * Quiesce IOs.
    * All sessions with remote ports are unregistered.
    */
   csio_hw_stop(hw);
   spin_unlock_irq(&hw->lock);
   csio_lnodes_unblock_request(hw);
   csio_lnodes_exit(hw, 0);
   csio_hw_free(hw);
-  pci_set_drvdata(pdev, NULL);
   csio_pci_exit(pdev, &bars);
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,57 +1,56 @@
 static int pmac_ide_pci_attach(struct pci_dev *pdev, const struct pci_device_id *id) {
   struct device_node *np;
   pmac_ide_hwif_t *pmif;
   void __iomem *base;
   unsigned long rbase, rlen;
   int rc;
   struct ide_hw hw;
   np = pci_device_to_OF_node(pdev);
   if (np == NULL) {
     printk(KERN_ERR "ide-pmac: cannot find MacIO node for Kauai ATA interface\n");
     return -ENODEV;
   }
   pmif = kzalloc(sizeof(*pmif), GFP_KERNEL);
   if (pmif == NULL) return -ENOMEM;
   if (pci_enable_device(pdev)) {
     printk(KERN_WARNING "ide-pmac: Can't enable PCI device for "
                         "%s\n",
            np->full_name);
     rc = -ENXIO;
     goto out_free_pmif;
   }
   pci_set_master(pdev);
 
   if (pci_request_regions(pdev, "Kauai ATA")) {
     printk(KERN_ERR "ide-pmac: Cannot obtain PCI resources for "
                     "%s\n",
            np->full_name);
     rc = -ENXIO;
     goto out_free_pmif;
   }
   pmif->mdev = NULL;
   pmif->node = np;
   rbase = pci_resource_start(pdev, 0);
   rlen = pci_resource_len(pdev, 0);
   base = ioremap(rbase, rlen);
   pmif->regbase = (unsigned long)base + 0x2000;
   pmif->dma_regs = base + 0x1000;
   pmif->kauai_fcr = base;
   pmif->irq = pdev->irq;
   pci_set_drvdata(pdev, pmif);
   memset(&hw, 0, sizeof(hw));
   pmac_ide_init_ports(&hw, pmif->regbase);
   hw.irq = pdev->irq;
   hw.dev = &pdev->dev;
   rc = pmac_ide_setup_device(pmif, &hw);
   if (rc != 0) {
     /* The inteface is released to the common IDE layer */
-    pci_set_drvdata(pdev, NULL);
     iounmap(base);
     pci_release_regions(pdev);
     kfree(pmif);
   }
   return rc;
 out_free_pmif:
   kfree(pmif);
   return rc;
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,16 +1,15 @@
 static int grvga_remove(struct platform_device *device) {
   struct fb_info *info = dev_get_drvdata(&device->dev);
   struct grvga_par *par = info->par;
   if (info) {
     unregister_framebuffer(info);
     fb_dealloc_cmap(&info->cmap);
     of_iounmap(&device->resource[0], par->regs, resource_size(&device->resource[0]));
     if (!par->fb_alloced)
       iounmap(info->screen_base);
     else
       kfree((void *)info->screen_base);
     framebuffer_release(info);
-    dev_set_drvdata(&device->dev, NULL);
   }
   return 0;
 }<sep>@@
expression dev;
@@

- dev_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,18 +1,17 @@
 static int dcp_remove(struct platform_device *pdev) {
   struct dcp_dev *dev;
   int j;
   dev = platform_get_drvdata(pdev);
-  platform_set_drvdata(pdev, NULL);
   dma_free_coherent(&pdev->dev, DCP_MAX_PKG * sizeof(struct dcp_hw_packet), dev->hw_pkg[0], dev->hw_phys_pkg);
   dma_free_coherent(&pdev->dev, 2 * AES_KEYSIZE_128, dev->payload_base, dev->payload_base_dma);
   free_irq(dev->dcp_irq, dev);
   free_irq(dev->dcp_vmi_irq, dev);
   tasklet_kill(&dev->done_task);
   tasklet_kill(&dev->queue_task);
   iounmap((void *)dev->dcp_regs_base);
   for (j = 0; j < ARRAY_SIZE(algs); j++)
     crypto_unregister_alg(&algs[j]);
   misc_deregister(&dev->dcp_bootstream_misc);
   kfree(dev);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,9 +1,8 @@
 static void stex_remove(struct pci_dev *pdev) {
   struct st_hba *hba = pci_get_drvdata(pdev);
   scsi_remove_host(hba->host);
-  pci_set_drvdata(pdev, NULL);
   stex_hba_stop(hba);
   stex_hba_free(hba);
   scsi_host_put(hba->host);
   pci_disable_device(pdev);
 }<sep>@@
expression pci;
@@

- pci_set_drvdata(pci, NULL);
--- initial
+++ final
@@ -1,22 +1,21 @@
 static int fec_drv_remove(struct platform_device *pdev) {
   struct net_device *ndev = platform_get_drvdata(pdev);
   struct fec_enet_private *fep = netdev_priv(ndev);
   int i;
   cancel_delayed_work_sync(&(fep->delay_work.delay_work));
   unregister_netdev(ndev);
   fec_enet_mii_remove(fep);
   del_timer_sync(&fep->time_keep);
   for (i = 0; i < FEC_IRQ_NUM; i++) {
     int irq = platform_get_irq(pdev, i);
     if (irq > 0) free_irq(irq, ndev);
   }
   if (fep->reg_phy) regulator_disable(fep->reg_phy);
   clk_disable_unprepare(fep->clk_ptp);
   if (fep->ptp_clock) ptp_clock_unregister(fep->ptp_clock);
   clk_disable_unprepare(fep->clk_enet_out);
   clk_disable_unprepare(fep->clk_ahb);
   clk_disable_unprepare(fep->clk_ipg);
   free_netdev(ndev);
-  platform_set_drvdata(pdev, NULL);
   return 0;
 }<sep>@@
expression dev;
@@

- platform_set_drvdata(dev, NULL);
--- initial
+++ final
@@ -1,27 +1,27 @@
 int cfs_expr_list_values(struct cfs_expr_list *expr_list, int max, u32 **valpp) {
   struct cfs_range_expr *expr;
   u32 *val;
   int count = 0;
   int i;
   list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
     for (i = expr->re_lo; i <= expr->re_hi; i++) {
       if (!((i - expr->re_lo) % expr->re_stride)) count++;
     }
   }
   if (!count) /* empty expression list */
     return 0;
   if (count > max) {
     CERROR("Number of values %d exceeds max allowed %d\n", max, count);
     return -EINVAL;
   }
-  LIBCFS_ALLOC(val, sizeof(val[0]) * count);
+  val = kmalloc(sizeof(val[0]) * count, GFP_NOFS);
   if (!val) return -ENOMEM;
   count = 0;
   list_for_each_entry(expr, &expr_list->el_exprs, re_link) {
     for (i = expr->re_lo; i <= expr->re_hi; i++) {
       if (!((i - expr->re_lo) % expr->re_stride)) val[count++] = i;
     }
   }
   *valpp = val;
   return count;
 }<sep>@@
expression buf,data;
@@
-	LIBCFS_ALLOC(buf, data);
+	buf = kmalloc(data, GFP_NOFS);
--- initial
+++ final
@@ -1,51 +1,51 @@
 struct lnet_ni *lnet_ni_alloc(__u32 net, struct cfs_expr_list *el, struct list_head *nilist) {
   struct lnet_tx_queue *tq;
   struct lnet_ni *ni;
   int rc;
   int i;
   if (!lnet_net_unique(net, nilist)) {
     LCONSOLE_ERROR_MSG(0x111, "Duplicate network specified: %s\n", libcfs_net2str(net));
     return NULL;
   }
   ni = kzalloc(sizeof(*ni), GFP_NOFS);
   if (!ni) {
     CERROR("Out of memory creating network %s\n", libcfs_net2str(net));
     return NULL;
   }
   spin_lock_init(&ni->ni_lock);
   INIT_LIST_HEAD(&ni->ni_cptlist);
   ni->ni_refs = cfs_percpt_alloc(lnet_cpt_table(), sizeof(*ni->ni_refs[0]));
   if (!ni->ni_refs) goto failed;
   ni->ni_tx_queues = cfs_percpt_alloc(lnet_cpt_table(), sizeof(*ni->ni_tx_queues[0]));
   if (!ni->ni_tx_queues) goto failed;
   cfs_percpt_for_each(tq, i, ni->ni_tx_queues) INIT_LIST_HEAD(&tq->tq_delayed);
   if (!el) {
     ni->ni_cpts = NULL;
     ni->ni_ncpts = LNET_CPT_NUMBER;
   } else {
     rc = cfs_expr_list_values(el, LNET_CPT_NUMBER, &ni->ni_cpts);
     if (rc <= 0) {
       CERROR("Failed to set CPTs for NI %s: %d\n", libcfs_net2str(net), rc);
       goto failed;
     }
     LASSERT(rc <= LNET_CPT_NUMBER);
     if (rc == LNET_CPT_NUMBER) {
-      LIBCFS_FREE(ni->ni_cpts, rc * sizeof(ni->ni_cpts[0]));
+      kfree(ni->ni_cpts);
       ni->ni_cpts = NULL;
     }
     ni->ni_ncpts = rc;
   }
   /* LND will fill in the address part of the NID */
   ni->ni_nid = LNET_MKNID(net, 0);
   /* Store net namespace in which current ni is being created */
   if (current->nsproxy->net_ns)
     ni->ni_net_ns = get_net(current->nsproxy->net_ns);
   else
     ni->ni_net_ns = NULL;
   ni->ni_last_alive = ktime_get_real_seconds();
   list_add_tail(&ni->ni_list, nilist);
   return ni;
 failed:
   lnet_ni_free(ni);
   return NULL;
 }<sep>@@
expression buf,data;
@@
-		LIBCFS_FREE(buf, data);
+		kfree(buf);
--- initial
+++ final
@@ -1,49 +1,49 @@
 static int lnet_ipaddr_enumerate(__u32 **ipaddrsp) {
   int up;
   __u32 netmask;
   __u32 *ipaddrs;
   __u32 *ipaddrs2;
   int nip;
   char **ifnames;
   int nif = lnet_ipif_enumerate(&ifnames);
   int i;
   int rc;
   if (nif <= 0) return nif;
-  LIBCFS_ALLOC(ipaddrs, nif * sizeof(*ipaddrs));
+  ipaddrs = kmalloc(nif * sizeof(*ipaddrs), GFP_NOFS);
   if (!ipaddrs) {
     CERROR("Can't allocate ipaddrs[%d]\n", nif);
     lnet_ipif_free_enumeration(ifnames, nif);
     return -ENOMEM;
   }
   for (i = nip = 0; i < nif; i++) {
     if (!strcmp(ifnames[i], "lo")) continue;
     rc = lnet_ipif_query(ifnames[i], &up, &ipaddrs[nip], &netmask);
     if (rc) {
       CWARN("Can't query interface %s: %d\n", ifnames[i], rc);
       continue;
     }
     if (!up) {
       CWARN("Ignoring interface %s: it's down\n", ifnames[i]);
       continue;
     }
     nip++;
   }
   lnet_ipif_free_enumeration(ifnames, nif);
   if (nip == nif) {
     *ipaddrsp = ipaddrs;
   } else {
     if (nip > 0) {
-      LIBCFS_ALLOC(ipaddrs2, nip * sizeof(*ipaddrs2));
+      ipaddrs2 = kmalloc(nip * sizeof(*ipaddrs2), GFP_NOFS);
       if (!ipaddrs2) {
         CERROR("Can't allocate ipaddrs[%d]\n", nip);
         nip = -ENOMEM;
       } else {
         memcpy(ipaddrs2, ipaddrs, nip * sizeof(*ipaddrs));
         *ipaddrsp = ipaddrs2;
         rc = nip;
       }
     }
-    LIBCFS_FREE(ipaddrs, nip * sizeof(*ipaddrs));
+    kfree(ipaddrs);
   }
   return nip;
 }<sep>@@
expression buf,data;
@@
-	LIBCFS_ALLOC(buf, data);
+	buf = kmalloc(data, GFP_NOFS);

@@
expression buf,data;
@@
-		LIBCFS_FREE(buf, data);
+		kfree(buf);
--- initial
+++ final
@@ -1,21 +1,21 @@
 static int lstcon_group_alloc(char *name, struct lstcon_group **grpp) {
   struct lstcon_group *grp;
   int i;
-  LIBCFS_ALLOC(grp, offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE]));
+  grp = kmalloc(offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE]), GFP_NOFS);
   if (!grp) return -ENOMEM;
   grp->grp_ref = 1;
   if (name) {
     if (strlen(name) > sizeof(grp->grp_name) - 1) {
-      LIBCFS_FREE(grp, offsetof(struct lstcon_group, grp_ndl_hash[LST_NODE_HASHSIZE]));
+      kfree(grp);
       return -E2BIG;
     }
     strncpy(grp->grp_name, name, sizeof(grp->grp_name));
   }
   INIT_LIST_HEAD(&grp->grp_link);
   INIT_LIST_HEAD(&grp->grp_ndl_list);
   INIT_LIST_HEAD(&grp->grp_trans_list);
   for (i = 0; i < LST_NODE_HASHSIZE; i++)
     INIT_LIST_HEAD(&grp->grp_ndl_hash[i]);
   *grpp = grp;
   return 0;
 }<sep>@@
expression buf,data;
@@
-	LIBCFS_ALLOC(buf, data);
+	buf = kmalloc(data, GFP_NOFS);

@@
expression buf,data;
@@
-		LIBCFS_FREE(buf, data);
+		kfree(buf);