imamnurby/smpl_train_seed8 huggingface dataset:
--- initial
+++ final
@@ -1,65 +1,67 @@
 static int lm90_probe(struct i2c_client *client, const struct i2c_device_id *id) {
   struct device *dev = &client->dev;
   struct i2c_adapter *adapter = to_i2c_adapter(dev->parent);
   struct lm90_data *data;
   struct regulator *regulator;
   struct device *hwmon_dev;
   int groups = 0;
   int err;
   regulator = devm_regulator_get(dev, "vcc");
   if (IS_ERR(regulator)) return PTR_ERR(regulator);
   err = regulator_enable(regulator);
   if (err < 0) {
     dev_err(dev, "Failed to enable regulator: %d\n", err);
     return err;
   }
-  devm_add_action(dev, lm90_regulator_disable, regulator);
+  err = devm_add_action_or_reset(dev, lm90_regulator_disable, regulator);
+  if (err) return err;
   data = devm_kzalloc(dev, sizeof(struct lm90_data), GFP_KERNEL);
   if (!data) return -ENOMEM;
   data->client = client;
   i2c_set_clientdata(client, data);
   mutex_init(&data->update_lock);
   /* Set the device type */
   data->kind = id->driver_data;
   if (data->kind == adm1032) {
     if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE)) client->flags &= ~I2C_CLIENT_PEC;
   }
   /*
    * Different devices have different alarm bits triggering the
    * ALERT# output
    */
   data->alert_alarms = lm90_params[data->kind].alert_alarms;
   /* Set chip capabilities */
   data->flags = lm90_params[data->kind].flags;
   data->reg_local_ext = lm90_params[data->kind].reg_local_ext;
   /* Set maximum conversion rate */
   data->max_convrate = lm90_params[data->kind].max_convrate;
   /* Initialize the LM90 chip */
   err = lm90_init_client(client, data);
   if (err < 0) {
     dev_err(dev, "Failed to initialize device\n");
     return err;
   }
   /* Register sysfs hooks */
   data->groups[groups++] = &lm90_group;
   if (data->flags & LM90_HAVE_OFFSET) data->groups[groups++] = &lm90_temp2_offset_group;
   if (data->flags & LM90_HAVE_EMERGENCY) data->groups[groups++] = &lm90_emergency_group;
   if (data->flags & LM90_HAVE_EMERGENCY_ALARM) data->groups[groups++] = &lm90_emergency_alarm_group;
   if (data->flags & LM90_HAVE_TEMP3) data->groups[groups++] = &lm90_temp3_group;
   if (client->flags & I2C_CLIENT_PEC) {
     err = device_create_file(dev, &dev_attr_pec);
     if (err) return err;
-    devm_add_action(dev, lm90_remove_pec, dev);
+    err = devm_add_action_or_reset(dev, lm90_remove_pec, dev);
+    if (err) return err;
   }
   hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name, data, data->groups);
   if (IS_ERR(hwmon_dev)) return PTR_ERR(hwmon_dev);
   if (client->irq) {
     dev_dbg(dev, "IRQ: %d\n", client->irq);
     err = devm_request_threaded_irq(dev, client->irq, NULL, lm90_irq_thread, IRQF_TRIGGER_LOW | IRQF_ONESHOT, "lm90", client);
     if (err < 0) {
       dev_err(dev, "cannot request IRQ %d\n", client->irq);
       return err;
     }
   }
   return 0;
 }<sep>@@
expression e1,e2,e3;
int err;
@@

	if (...) { ... return err; }
	... when any
-       devm_add_action(e1,e2,e3);
+       err = devm_add_action_or_reset(e1,e2,e3);
+       if (err)
+               return err;
--- initial
+++ final
@@ -1,73 +1,73 @@
 static int b44_init_one(struct ssb_device *sdev, const struct ssb_device_id *ent) {
   struct net_device *dev;
   struct b44 *bp;
   int err;
   instance++;
   pr_info_once("%s version %s\n", DRV_DESCRIPTION, DRV_MODULE_VERSION);
   dev = alloc_etherdev(sizeof(*bp));
   if (!dev) {
     err = -ENOMEM;
     goto out;
   }
   SET_NETDEV_DEV(dev, sdev->dev);
   /* No interesting netdevice features in this card... */
   dev->features |= 0;
   bp = netdev_priv(dev);
   bp->sdev = sdev;
   bp->dev = dev;
   bp->force_copybreak = 0;
   bp->msg_enable = netif_msg_init(b44_debug, B44_DEF_MSG_ENABLE);
   spin_lock_init(&bp->lock);
   bp->rx_pending = B44_DEF_RX_RING_PENDING;
   bp->tx_pending = B44_DEF_TX_RING_PENDING;
   dev->netdev_ops = &b44_netdev_ops;
   netif_napi_add(dev, &bp->napi, b44_poll, 64);
   dev->watchdog_timeo = B44_TX_TIMEOUT;
   dev->irq = sdev->irq;
   SET_ETHTOOL_OPS(dev, &b44_ethtool_ops);
   err = ssb_bus_powerup(sdev->bus, 0);
   if (err) {
     dev_err(sdev->dev, "Failed to powerup the bus\n");
     goto err_out_free_dev;
   }
-  if (dma_set_mask(sdev->dma_dev, DMA_BIT_MASK(30)) || dma_set_coherent_mask(sdev->dma_dev, DMA_BIT_MASK(30))) {
+  if (dma_set_mask_and_coherent(sdev->dma_dev, DMA_BIT_MASK(30))) {
     dev_err(sdev->dev, "Required 30BIT DMA mask unsupported by the system\n");
     goto err_out_powerdown;
   }
   err = b44_get_invariants(bp);
   if (err) {
     dev_err(sdev->dev, "Problem fetching invariants of chip, aborting\n");
     goto err_out_powerdown;
   }
   bp->mii_if.dev = dev;
   bp->mii_if.mdio_read = b44_mii_read;
   bp->mii_if.mdio_write = b44_mii_write;
   bp->mii_if.phy_id = bp->phy_addr;
   bp->mii_if.phy_id_mask = 0x1f;
   bp->mii_if.reg_num_mask = 0x1f;
   /* By default, advertise all speed/duplex settings. */
   bp->flags |= (B44_FLAG_ADV_10HALF | B44_FLAG_ADV_10FULL | B44_FLAG_ADV_100HALF | B44_FLAG_ADV_100FULL);
   /* By default, auto-negotiate PAUSE. */
   bp->flags |= B44_FLAG_PAUSE_AUTO;
   err = register_netdev(dev);
   if (err) {
     dev_err(sdev->dev, "Cannot register net device, aborting\n");
     goto err_out_powerdown;
   }
   netif_carrier_off(dev);
   ssb_set_drvdata(sdev, dev);
   /* Chip reset provides power to the b44 MAC & PCI cores, which
    * is necessary for MAC register access.
    */
   b44_chip_reset(bp, B44_CHIP_RESET_FULL);
   /* do a phy reset to test if there is an active phy */
   if (b44_phy_reset(bp) < 0) bp->phy_addr = B44_PHY_ADDR_NO_PHY;
   netdev_info(dev, "%s %pM\n", DRV_DESCRIPTION, dev->dev_addr);
   return 0;
 err_out_powerdown:
   ssb_bus_may_powerdown(sdev->bus);
 err_out_free_dev:
   free_netdev(dev);
 out:
   return err;
 }<sep>@@
expression e,v;
statement S;
@@

-	if (dma_set_mask(e, v) || dma_set_coherent_mask(e, v))
+	if (dma_set_mask_and_coherent(e, v))
 		S
--- initial
+++ final
@@ -1,42 +1,42 @@
 static int ssb_hcd_probe(struct ssb_device *dev, const struct ssb_device_id *id) {
   int err, tmp;
   int start, len;
   u16 chipid_top;
   u16 coreid = dev->id.coreid;
   struct ssb_hcd_device *usb_dev;
   /* USBcores are only connected on embedded devices. */
   chipid_top = (dev->bus->chip_id & 0xFF00);
   if (chipid_top != 0x4700 && chipid_top != 0x5300) return -ENODEV;
   /* TODO: Probably need checks here; is the core connected? */
-  if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32))) return -EOPNOTSUPP;
+  if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) return -EOPNOTSUPP;
   usb_dev = kzalloc(sizeof(struct ssb_hcd_device), GFP_KERNEL);
   if (!usb_dev) return -ENOMEM;
   /* We currently always attach SSB_DEV_USB11_HOSTDEV
    * as HOST OHCI. If we want to attach it as Client device,
    * we must branch here and call into the (yet to
    * be written) Client mode driver. Same for remove(). */
   usb_dev->enable_flags = ssb_hcd_init_chip(dev);
   tmp = ssb_read32(dev, SSB_ADMATCH0);
   start = ssb_admatch_base(tmp);
   len = (coreid == SSB_DEV_USB20_HOST) ? 0x800 : ssb_admatch_size(tmp);
   usb_dev->ohci_dev = ssb_hcd_create_pdev(dev, true, start, len);
   if (IS_ERR(usb_dev->ohci_dev)) {
     err = PTR_ERR(usb_dev->ohci_dev);
     goto err_free_usb_dev;
   }
   if (coreid == SSB_DEV_USB20_HOST) {
     start = ssb_admatch_base(tmp) + 0x800; /* ehci core offset */
     usb_dev->ehci_dev = ssb_hcd_create_pdev(dev, false, start, len);
     if (IS_ERR(usb_dev->ehci_dev)) {
       err = PTR_ERR(usb_dev->ehci_dev);
       goto err_unregister_ohci_dev;
     }
   }
   ssb_set_drvdata(dev, usb_dev);
   return 0;
 err_unregister_ohci_dev:
   platform_device_unregister(usb_dev->ohci_dev);
 err_free_usb_dev:
   kfree(usb_dev);
   return err;
 }<sep>@@
expression e,v;
statement S;
@@

-	if (dma_set_mask(e, v) || dma_set_coherent_mask(e, v))
+	if (dma_set_mask_and_coherent(e, v))
 		S
--- initial
+++ final
@@ -1,36 +1,36 @@
 static int bcma_hcd_probe(struct bcma_device *dev) {
   int err;
   u16 chipid_top;
   u32 ohci_addr;
   struct bcma_hcd_device *usb_dev;
   struct bcma_chipinfo *chipinfo;
   chipinfo = &dev->bus->chipinfo;
   /* USBcores are only connected on embedded devices. */
   chipid_top = (chipinfo->id & 0xFF00);
   if (chipid_top != 0x4700 && chipid_top != 0x5300) return -ENODEV;
   /* TODO: Probably need checks here; is the core connected? */
-  if (dma_set_mask(dev->dma_dev, DMA_BIT_MASK(32)) || dma_set_coherent_mask(dev->dma_dev, DMA_BIT_MASK(32))) return -EOPNOTSUPP;
+  if (dma_set_mask_and_coherent(dev->dma_dev, DMA_BIT_MASK(32))) return -EOPNOTSUPP;
   usb_dev = kzalloc(sizeof(struct bcma_hcd_device), GFP_KERNEL);
   if (!usb_dev) return -ENOMEM;
   bcma_hcd_init_chip(dev);
   /* In AI chips EHCI is addrspace 0, OHCI is 1 */
   ohci_addr = dev->addr1;
   if ((chipinfo->id == 0x5357 || chipinfo->id == 0x4749) && chipinfo->rev == 0) ohci_addr = 0x18009000;
   usb_dev->ohci_dev = bcma_hcd_create_pdev(dev, true, ohci_addr);
   if (IS_ERR(usb_dev->ohci_dev)) {
     err = PTR_ERR(usb_dev->ohci_dev);
     goto err_free_usb_dev;
   }
   usb_dev->ehci_dev = bcma_hcd_create_pdev(dev, false, dev->addr);
   if (IS_ERR(usb_dev->ehci_dev)) {
     err = PTR_ERR(usb_dev->ehci_dev);
     goto err_unregister_ohci_dev;
   }
   bcma_set_drvdata(dev, usb_dev);
   return 0;
 err_unregister_ohci_dev:
   platform_device_unregister(usb_dev->ohci_dev);
 err_free_usb_dev:
   kfree(usb_dev);
   return err;
 }<sep>@@
expression e,v;
statement S;
@@

-	if (dma_set_mask(e, v) || dma_set_coherent_mask(e, v))
+	if (dma_set_mask_and_coherent(e, v))
 		S
--- initial
+++ final
@@ -1,70 +1,69 @@
 static int ci_hdrc_imx_probe(struct platform_device *pdev) {
   struct ci_hdrc_imx_data *data;
   struct ci_hdrc_platform_data pdata = {
       .name = "ci_hdrc_imx",
       .capoffset = DEF_CAPOFFSET,
       .flags = CI_HDRC_REQUIRE_TRANSCEIVER | CI_HDRC_DISABLE_STREAMING,
   };
   int ret;
   data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
   if (!data) {
     dev_err(&pdev->dev, "Failed to allocate ci_hdrc-imx data!\n");
     return -ENOMEM;
   }
   data->usbmisc_data = usbmisc_get_init_data(&pdev->dev);
   if (IS_ERR(data->usbmisc_data)) return PTR_ERR(data->usbmisc_data);
   data->clk = devm_clk_get(&pdev->dev, NULL);
   if (IS_ERR(data->clk)) {
     dev_err(&pdev->dev, "Failed to get clock, err=%ld\n", PTR_ERR(data->clk));
     return PTR_ERR(data->clk);
   }
   ret = clk_prepare_enable(data->clk);
   if (ret) {
     dev_err(&pdev->dev, "Failed to prepare or enable clock, err=%d\n", ret);
     return ret;
   }
   data->phy = devm_usb_get_phy_by_phandle(&pdev->dev, "fsl,usbphy", 0);
   if (!IS_ERR(data->phy)) {
     ret = usb_phy_init(data->phy);
     if (ret) {
       dev_err(&pdev->dev, "unable to init phy: %d\n", ret);
       goto err_clk;
     }
   } else if (PTR_ERR(data->phy) == -EPROBE_DEFER) {
     ret = -EPROBE_DEFER;
     goto err_clk;
   }
   pdata.phy = data->phy;
-  if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (ret) goto err_clk;
   if (data->usbmisc_data) {
     ret = imx_usbmisc_init(data->usbmisc_data);
     if (ret) {
       dev_err(&pdev->dev, "usbmisc init failed, ret=%d\n", ret);
       goto err_clk;
     }
   }
   data->ci_pdev = ci_hdrc_add_device(&pdev->dev, pdev->resource, pdev->num_resources, &pdata);
   if (IS_ERR(data->ci_pdev)) {
     ret = PTR_ERR(data->ci_pdev);
     dev_err(&pdev->dev, "Can't register ci_hdrc platform device, err=%d\n", ret);
     goto err_clk;
   }
   if (data->usbmisc_data) {
     ret = imx_usbmisc_init_post(data->usbmisc_data);
     if (ret) {
       dev_err(&pdev->dev, "usbmisc post failed, ret=%d\n", ret);
       goto disable_device;
     }
   }
   platform_set_drvdata(pdev, data);
   pm_runtime_no_callbacks(&pdev->dev);
   pm_runtime_enable(&pdev->dev);
   return 0;
 disable_device:
   ci_hdrc_remove_device(data->ci_pdev);
 err_clk:
   clk_disable_unprepare(data->clk);
   return ret;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,51 +1,50 @@
 static int dwc3_exynos_probe(struct platform_device *pdev) {
   struct dwc3_exynos *exynos;
   struct clk *clk;
   struct device *dev = &pdev->dev;
   struct device_node *node = dev->of_node;
   int ret = -ENOMEM;
   exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL);
   if (!exynos) {
     dev_err(dev, "not enough memory\n");
     goto err1;
   }
   /*
    * Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we move to full device tree support this will vanish off.
    */
-  if (!dev->dma_mask) dev->dma_mask = &dev->coherent_dma_mask;
-  ret = dma_set_coherent_mask(dev, DMA_BIT_MASK(32));
+  ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32));
   if (ret) goto err1;
   platform_set_drvdata(pdev, exynos);
   ret = dwc3_exynos_register_phys(exynos);
   if (ret) {
     dev_err(dev, "couldn't register PHYs\n");
     goto err1;
   }
   clk = devm_clk_get(dev, "usbdrd30");
   if (IS_ERR(clk)) {
     dev_err(dev, "couldn't get clock\n");
     ret = -EINVAL;
     goto err1;
   }
   exynos->dev = dev;
   exynos->clk = clk;
   clk_prepare_enable(exynos->clk);
   if (node) {
     ret = of_platform_populate(node, NULL, NULL, dev);
     if (ret) {
       dev_err(dev, "failed to add dwc3 core\n");
       goto err2;
     }
   } else {
     dev_err(dev, "no device node, failed to add dwc3 core\n");
     ret = -ENODEV;
     goto err2;
   }
   return 0;
 err2:
   clk_disable_unprepare(clk);
 err1:
   return ret;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev->dma_mask)
-               dev->dma_mask = &dev->coherent_dma_mask;
-       ret = dma_set_coherent_mask(dev, v);
+       ret = dma_coerce_mask_and_coherent(dev, v);
--- initial
+++ final
@@ -1,67 +1,66 @@
 static int ehci_atmel_drv_probe(struct platform_device *pdev) {
   struct usb_hcd *hcd;
   const struct hc_driver *driver = &ehci_atmel_hc_driver;
   struct resource *res;
   struct ehci_hcd *ehci;
   int irq;
   int retval;
   if (usb_disabled()) return -ENODEV;
   pr_debug("Initializing Atmel-SoC USB Host Controller\n");
   irq = platform_get_irq(pdev, 0);
   if (irq <= 0) {
     dev_err(&pdev->dev, "Found HC with no IRQ. Check %s setup!\n", dev_name(&pdev->dev));
     retval = -ENODEV;
     goto fail_create_hcd;
   }
   /* Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we have dma capability bindings this can go away.
    */
-  if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (retval) goto fail_create_hcd;
   hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
   if (!hcd) {
     retval = -ENOMEM;
     goto fail_create_hcd;
   }
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
     dev_err(&pdev->dev, "Found HC with no register addr. Check %s setup!\n", dev_name(&pdev->dev));
     retval = -ENODEV;
     goto fail_request_resource;
   }
   hcd->rsrc_start = res->start;
   hcd->rsrc_len = resource_size(res);
   hcd->regs = devm_ioremap_resource(&pdev->dev, res);
   if (IS_ERR(hcd->regs)) {
     retval = PTR_ERR(hcd->regs);
     goto fail_request_resource;
   }
   iclk = devm_clk_get(&pdev->dev, "ehci_clk");
   if (IS_ERR(iclk)) {
     dev_err(&pdev->dev, "Error getting interface clock\n");
     retval = -ENOENT;
     goto fail_request_resource;
   }
   fclk = devm_clk_get(&pdev->dev, "uhpck");
   if (IS_ERR(fclk)) {
     dev_err(&pdev->dev, "Error getting function clock\n");
     retval = -ENOENT;
     goto fail_request_resource;
   }
   ehci = hcd_to_ehci(hcd);
   /* registers start at offset 0x0 */
   ehci->caps = hcd->regs;
   atmel_start_ehci(pdev);
   retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
   if (retval) goto fail_add_hcd;
   return retval;
 fail_add_hcd:
   atmel_stop_ehci(pdev);
 fail_request_resource:
   usb_put_hcd(hcd);
 fail_create_hcd:
   dev_err(&pdev->dev, "init %s fail, %d\n", dev_name(&pdev->dev), retval);
   return retval;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,52 +1,51 @@
 static int ehci_platform_probe(struct platform_device *dev) {
   struct usb_hcd *hcd;
   struct resource *res_mem;
   struct usb_ehci_pdata *pdata;
   int irq;
   int err;
   if (usb_disabled()) return -ENODEV;
   /*
    * use reasonable defaults so platforms don't have to provide these.
    * with DT probing on ARM, none of these are set.
    */
   if (!dev_get_platdata(&dev->dev)) dev->dev.platform_data = &ehci_platform_defaults;
-  if (!dev->dev.dma_mask) dev->dev.dma_mask = &dev->dev.coherent_dma_mask;
-  err = dma_set_coherent_mask(&dev->dev, DMA_BIT_MASK(32));
+  err = dma_coerce_mask_and_coherent(&dev->dev, DMA_BIT_MASK(32));
   if (err) return err;
   pdata = dev_get_platdata(&dev->dev);
   irq = platform_get_irq(dev, 0);
   if (irq < 0) {
     dev_err(&dev->dev, "no irq provided");
     return irq;
   }
   res_mem = platform_get_resource(dev, IORESOURCE_MEM, 0);
   if (!res_mem) {
     dev_err(&dev->dev, "no memory resource provided");
     return -ENXIO;
   }
   if (pdata->power_on) {
     err = pdata->power_on(dev);
     if (err < 0) return err;
   }
   hcd = usb_create_hcd(&ehci_platform_hc_driver, &dev->dev, dev_name(&dev->dev));
   if (!hcd) {
     err = -ENOMEM;
     goto err_power;
   }
   hcd->rsrc_start = res_mem->start;
   hcd->rsrc_len = resource_size(res_mem);
   hcd->regs = devm_ioremap_resource(&dev->dev, res_mem);
   if (IS_ERR(hcd->regs)) {
     err = PTR_ERR(hcd->regs);
     goto err_put_hcd;
   }
   err = usb_add_hcd(hcd, irq, IRQF_SHARED);
   if (err) goto err_put_hcd;
   platform_set_drvdata(dev, hcd);
   return err;
 err_put_hcd:
   usb_put_hcd(hcd);
 err_power:
   if (pdata->power_off) pdata->power_off(dev);
   return err;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,65 +1,64 @@
 static int spear_ehci_hcd_drv_probe(struct platform_device *pdev) {
   struct usb_hcd *hcd;
   struct spear_ehci *sehci;
   struct resource *res;
   struct clk *usbh_clk;
   const struct hc_driver *driver = &ehci_spear_hc_driver;
   int irq, retval;
   if (usb_disabled()) return -ENODEV;
   irq = platform_get_irq(pdev, 0);
   if (irq < 0) {
     retval = irq;
     goto fail;
   }
   /*
    * Right now device-tree probed devices don't get dma_mask set.
    * Since shared usb code relies on it, set it here for now.
    * Once we have dma capability bindings this can go away.
    */
-  if (!pdev->dev.dma_mask) pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  retval = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  retval = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (retval) goto fail;
   usbh_clk = devm_clk_get(&pdev->dev, NULL);
   if (IS_ERR(usbh_clk)) {
     dev_err(&pdev->dev, "Error getting interface clock\n");
     retval = PTR_ERR(usbh_clk);
     goto fail;
   }
   hcd = usb_create_hcd(driver, &pdev->dev, dev_name(&pdev->dev));
   if (!hcd) {
     retval = -ENOMEM;
     goto fail;
   }
   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (!res) {
     retval = -ENODEV;
     goto err_put_hcd;
   }
   hcd->rsrc_start = res->start;
   hcd->rsrc_len = resource_size(res);
   if (!devm_request_mem_region(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len, driver->description)) {
     retval = -EBUSY;
     goto err_put_hcd;
   }
   hcd->regs = devm_ioremap(&pdev->dev, hcd->rsrc_start, hcd->rsrc_len);
   if (hcd->regs == NULL) {
     dev_dbg(&pdev->dev, "error mapping memory\n");
     retval = -ENOMEM;
     goto err_put_hcd;
   }
   sehci = to_spear_ehci(hcd);
   sehci->clk = usbh_clk;
   /* registers start at offset 0x0 */
   hcd_to_ehci(hcd)->caps = hcd->regs;
   clk_prepare_enable(sehci->clk);
   retval = usb_add_hcd(hcd, irq, IRQF_SHARED);
   if (retval) goto err_stop_ehci;
   return retval;
 err_stop_ehci:
   clk_disable_unprepare(sehci->clk);
 err_put_hcd:
   usb_put_hcd(hcd);
 fail:
   dev_err(&pdev->dev, "init fail, %d\n", retval);
   return retval;
 }<sep>@@
expression ret,dev,v;
@@

-       if (!dev.dma_mask)
-               dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);
--- initial
+++ final
@@ -1,61 +1,60 @@
 static int ohci_octeon_drv_probe(struct platform_device *pdev) {
   struct usb_hcd *hcd;
   struct ohci_hcd *ohci;
   void *reg_base;
   struct resource *res_mem;
   int irq;
   int ret;
   if (usb_disabled()) return -ENODEV;
   irq = platform_get_irq(pdev, 0);
   if (irq < 0) {
     dev_err(&pdev->dev, "No irq assigned\n");
     return -ENODEV;
   }
   res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
   if (res_mem == NULL) {
     dev_err(&pdev->dev, "No register space assigned\n");
     return -ENODEV;
   }
   /* Ohci is a 32-bit device. */
-  pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask;
-  ret = dma_set_coherent_mask(&pdev->dev, DMA_BIT_MASK(32));
+  ret = dma_coerce_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
   if (ret) return ret;
   hcd = usb_create_hcd(&ohci_octeon_hc_driver, &pdev->dev, "octeon");
   if (!hcd) return -ENOMEM;
   hcd->rsrc_start = res_mem->start;
   hcd->rsrc_len = resource_size(res_mem);
   if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, OCTEON_OHCI_HCD_NAME)) {
     dev_err(&pdev->dev, "request_mem_region failed\n");
     ret = -EBUSY;
     goto err1;
   }
   reg_base = ioremap(hcd->rsrc_start, hcd->rsrc_len);
   if (!reg_base) {
     dev_err(&pdev->dev, "ioremap failed\n");
     ret = -ENOMEM;
     goto err2;
   }
   ohci_octeon_hw_start();
   hcd->regs = reg_base;
   ohci = hcd_to_ohci(hcd);
   /* Octeon OHCI matches CPU endianness. */
 #ifdef __BIG_ENDIAN
   ohci->flags |= OHCI_QUIRK_BE_MMIO;
 #endif
   ohci_hcd_init(ohci);
   ret = usb_add_hcd(hcd, irq, IRQF_SHARED);
   if (ret) {
     dev_dbg(&pdev->dev, "failed to add hcd with err %d\n", ret);
     goto err3;
   }
   platform_set_drvdata(pdev, hcd);
   return 0;
 err3:
   ohci_octeon_hw_stop();
   iounmap(hcd->regs);
 err2:
   release_mem_region(hcd->rsrc_start, hcd->rsrc_len);
 err1:
   usb_put_hcd(hcd);
   return ret;
 }<sep>@@
expression ret,dev,v;
@@

-       dev.dma_mask = &dev.coherent_dma_mask;
-       ret = dma_set_coherent_mask(&dev, v);
+       ret = dma_coerce_mask_and_coherent(&dev, v);