}
 
        /* Retrieve DCB config and ensure same as current in SW */
-       prev_cfg = devm_kmemdup(&pf->pdev->dev, local_dcbx_cfg,
-                               sizeof(*prev_cfg), GFP_KERNEL);
+       prev_cfg = kmemdup(local_dcbx_cfg, sizeof(*prev_cfg), GFP_KERNEL);
        if (!prev_cfg) {
                dev_err(&pf->pdev->dev, "Failed to alloc space for DCB cfg\n");
                goto dcb_error;
        if (ice_dcb_need_recfg(pf, prev_cfg, local_dcbx_cfg)) {
                /* difference in cfg detected - disable DCB till next MIB */
                dev_err(&pf->pdev->dev, "Set local MIB not accurate\n");
+               kfree(prev_cfg);
                goto dcb_error;
        }
 
        /* fetched config congruent to previous configuration */
-       devm_kfree(&pf->pdev->dev, prev_cfg);
+       kfree(prev_cfg);
 
        /* Set the local desired config */
        if (local_dcbx_cfg->dcbx_mode == ICE_DCBX_MODE_CEE)
 
 dcb_error:
        dev_err(&pf->pdev->dev, "Disabling DCB until new settings occur\n");
-       prev_cfg = devm_kzalloc(&pf->pdev->dev, sizeof(*prev_cfg), GFP_KERNEL);
+       prev_cfg = kzalloc(sizeof(*prev_cfg), GFP_KERNEL);
+       if (!prev_cfg)
+               return;
+
        prev_cfg->etscfg.willing = true;
        prev_cfg->etscfg.tcbwtable[0] = ICE_TC_MAX_BW;
        prev_cfg->etscfg.tsatable[0] = ICE_IEEE_TSA_ETS;
        memcpy(&prev_cfg->etsrec, &prev_cfg->etscfg, sizeof(prev_cfg->etsrec));
        ice_pf_dcb_cfg(pf, prev_cfg, false);
-       devm_kfree(&pf->pdev->dev, prev_cfg);
+       kfree(prev_cfg);
 }
 
 /**
        int ret = 0;
 
        pi = pf->hw.port_info;
-       newcfg = devm_kzalloc(&pf->pdev->dev, sizeof(*newcfg), GFP_KERNEL);
+       newcfg = kmemdup(&pi->local_dcbx_cfg, sizeof(*newcfg), GFP_KERNEL);
        if (!newcfg)
                return -ENOMEM;
 
-       memcpy(newcfg, &pi->local_dcbx_cfg, sizeof(*newcfg));
        memset(&pi->local_dcbx_cfg, 0, sizeof(*newcfg));
 
        dev_info(&pf->pdev->dev, "Configuring initial DCB values\n");
        if (ice_pf_dcb_cfg(pf, newcfg, locked))
                ret = -EINVAL;
 
-       devm_kfree(&pf->pdev->dev, newcfg);
+       kfree(newcfg);
 
        return ret;
 }
 
        hw = &pf->hw;
        pi = hw->port_info;
-       dcbcfg = devm_kzalloc(&pf->pdev->dev, sizeof(*dcbcfg), GFP_KERNEL);
+       dcbcfg = kzalloc(sizeof(*dcbcfg), GFP_KERNEL);
+       if (!dcbcfg)
+               return -ENOMEM;
 
-       memset(dcbcfg, 0, sizeof(*dcbcfg));
        memset(&pi->local_dcbx_cfg, 0, sizeof(*dcbcfg));
 
        dcbcfg->etscfg.willing = ets_willing ? 1 : 0;
        dcbcfg->app[0].prot_id = ICE_APP_PROT_ID_FCOE;
 
        ret = ice_pf_dcb_cfg(pf, dcbcfg, locked);
-       devm_kfree(&pf->pdev->dev, dcbcfg);
+       kfree(dcbcfg);
        if (ret)
                return ret;
 
 
        }
 
        /* Get last SW configuration */
-       caps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*caps), GFP_KERNEL);
+       caps = kzalloc(sizeof(*caps), GFP_KERNEL);
        if (!caps)
                return -ENOMEM;
 
        }
 
 done:
-       devm_kfree(&vsi->back->pdev->dev, caps);
+       kfree(caps);
        return err;
 }
 
                break;
        }
 
-       caps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*caps), GFP_KERNEL);
+       caps = kzalloc(sizeof(*caps), GFP_KERNEL);
        if (!caps)
                return -ENOMEM;
 
                fecparam->fec |= ETHTOOL_FEC_OFF;
 
 done:
-       devm_kfree(&vsi->back->pdev->dev, caps);
+       kfree(caps);
        return err;
 }
 
        /* flow control is symmetric and always supported */
        ethtool_link_ksettings_add_link_mode(ks, supported, Pause);
 
-       caps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*caps), GFP_KERNEL);
+       caps = kzalloc(sizeof(*caps), GFP_KERNEL);
        if (!caps)
                return -ENOMEM;
 
                ethtool_link_ksettings_add_link_mode(ks, supported, FEC_RS);
 
 done:
-       devm_kfree(&vsi->back->pdev->dev, caps);
+       kfree(caps);
        return err;
 }
 
                usleep_range(TEST_SET_BITS_SLEEP_MIN, TEST_SET_BITS_SLEEP_MAX);
        }
 
-       abilities = devm_kzalloc(&pf->pdev->dev, sizeof(*abilities),
-                                GFP_KERNEL);
+       abilities = kzalloc(sizeof(*abilities), GFP_KERNEL);
        if (!abilities)
                return -ENOMEM;
 
        }
 
 done:
-       devm_kfree(&pf->pdev->dev, abilities);
+       kfree(abilities);
        clear_bit(__ICE_CFG_BUSY, pf->state);
 
        return err;
        netdev_info(netdev, "Changing Tx descriptor count from %d to %d\n",
                    vsi->tx_rings[0]->count, new_tx_cnt);
 
-       tx_rings = devm_kcalloc(&pf->pdev->dev, vsi->num_txq,
-                               sizeof(*tx_rings), GFP_KERNEL);
+       tx_rings = kcalloc(vsi->num_txq, sizeof(*tx_rings), GFP_KERNEL);
        if (!tx_rings) {
                err = -ENOMEM;
                goto done;
                if (err) {
                        while (i--)
                                ice_clean_tx_ring(&tx_rings[i]);
-                       devm_kfree(&pf->pdev->dev, tx_rings);
+                       kfree(tx_rings);
                        goto done;
                }
        }
        netdev_info(netdev, "Changing XDP descriptor count from %d to %d\n",
                    vsi->xdp_rings[0]->count, new_tx_cnt);
 
-       xdp_rings = devm_kcalloc(&pf->pdev->dev, vsi->num_xdp_txq,
-                                sizeof(*xdp_rings), GFP_KERNEL);
+       xdp_rings = kcalloc(vsi->num_xdp_txq, sizeof(*xdp_rings), GFP_KERNEL);
        if (!xdp_rings) {
                err = -ENOMEM;
                goto free_tx;
                if (err) {
                        while (i--)
                                ice_clean_tx_ring(&xdp_rings[i]);
-                       devm_kfree(&pf->pdev->dev, xdp_rings);
+                       kfree(xdp_rings);
                        goto free_tx;
                }
                ice_set_ring_xdp(&xdp_rings[i]);
        netdev_info(netdev, "Changing Rx descriptor count from %d to %d\n",
                    vsi->rx_rings[0]->count, new_rx_cnt);
 
-       rx_rings = devm_kcalloc(&pf->pdev->dev, vsi->num_rxq,
-                               sizeof(*rx_rings), GFP_KERNEL);
+       rx_rings = kcalloc(vsi->num_rxq, sizeof(*rx_rings), GFP_KERNEL);
        if (!rx_rings) {
                err = -ENOMEM;
                goto done;
                                i--;
                                ice_free_rx_ring(&rx_rings[i]);
                        }
-                       devm_kfree(&pf->pdev->dev, rx_rings);
+                       kfree(rx_rings);
                        err = -ENOMEM;
                        goto free_tx;
                }
                                ice_free_tx_ring(vsi->tx_rings[i]);
                                *vsi->tx_rings[i] = tx_rings[i];
                        }
-                       devm_kfree(&pf->pdev->dev, tx_rings);
+                       kfree(tx_rings);
                }
 
                if (rx_rings) {
                                rx_rings[i].next_to_alloc = 0;
                                *vsi->rx_rings[i] = rx_rings[i];
                        }
-                       devm_kfree(&pf->pdev->dev, rx_rings);
+                       kfree(rx_rings);
                }
 
                if (xdp_rings) {
                                ice_free_tx_ring(vsi->xdp_rings[i]);
                                *vsi->xdp_rings[i] = xdp_rings[i];
                        }
-                       devm_kfree(&pf->pdev->dev, xdp_rings);
+                       kfree(xdp_rings);
                }
 
                vsi->num_tx_desc = new_tx_cnt;
        if (tx_rings) {
                ice_for_each_txq(vsi, i)
                        ice_free_tx_ring(&tx_rings[i]);
-               devm_kfree(&pf->pdev->dev, tx_rings);
+               kfree(tx_rings);
        }
 
 done:
        struct ice_netdev_priv *np = netdev_priv(netdev);
        struct ice_port_info *pi = np->vsi->port_info;
        struct ice_aqc_get_phy_caps_data *pcaps;
-       struct ice_vsi *vsi = np->vsi;
        struct ice_dcbx_cfg *dcbx_cfg;
        enum ice_status status;
 
 
        dcbx_cfg = &pi->local_dcbx_cfg;
 
-       pcaps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*pcaps),
-                            GFP_KERNEL);
+       pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
        if (!pcaps)
                return;
 
                pause->rx_pause = 1;
 
 out:
-       devm_kfree(&vsi->back->pdev->dev, pcaps);
+       kfree(pcaps);
 }
 
 /**
                return -EIO;
        }
 
-       lut = devm_kzalloc(&pf->pdev->dev, vsi->rss_table_size, GFP_KERNEL);
+       lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
        if (!lut)
                return -ENOMEM;
 
                indir[i] = (u32)(lut[i]);
 
 out:
-       devm_kfree(&pf->pdev->dev, lut);
+       kfree(lut);
        return ret;
 }
 
 
        struct ice_vsi_ctx *ctxt;
        enum ice_status status;
 
-       ctxt = devm_kzalloc(&pf->pdev->dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return;
 
                dev_err(&pf->pdev->dev, "Failed to delete VSI %i in FW\n",
                        vsi->vsi_num);
 
-       devm_kfree(&pf->pdev->dev, ctxt);
+       kfree(ctxt);
 }
 
 /**
        struct ice_vsi_ctx *ctxt;
        int ret = 0;
 
-       ctxt = devm_kzalloc(&pf->pdev->dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
                ctxt->vf_num = vsi->vf_id + hw->func_caps.vf_base_id;
                break;
        default:
-               return -ENODEV;
+               ret = -ENODEV;
+               goto out;
        }
 
        ice_set_dflt_vsi_ctx(ctxt);
        if (ret) {
                dev_err(&pf->pdev->dev,
                        "Add VSI failed, err %d\n", ret);
-               return -EIO;
+               ret = -EIO;
+               goto out;
        }
 
        /* keep context for update VSI operations */
        /* record VSI number returned */
        vsi->vsi_num = ctxt->vsi_num;
 
-       devm_kfree(&pf->pdev->dev, ctxt);
+out:
+       kfree(ctxt);
        return ret;
 }
 
        int err = 0;
        u8 *lut;
 
-       lut = devm_kzalloc(&vsi->back->pdev->dev, vsi->rss_table_size,
-                          GFP_KERNEL);
+       lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
        if (!lut)
                return -ENOMEM;
 
        }
 
        err = ice_set_rss(vsi, NULL, lut, vsi->rss_table_size);
-       devm_kfree(&vsi->back->pdev->dev, lut);
+       kfree(lut);
        return err;
 }
 
 
        vsi->rss_size = min_t(int, vsi->rss_size, vsi->num_rxq);
 
-       lut = devm_kzalloc(&pf->pdev->dev, vsi->rss_table_size, GFP_KERNEL);
+       lut = kzalloc(vsi->rss_table_size, GFP_KERNEL);
        if (!lut)
                return -ENOMEM;
 
                goto ice_vsi_cfg_rss_exit;
        }
 
-       key = devm_kzalloc(&pf->pdev->dev, sizeof(*key), GFP_KERNEL);
+       key = kzalloc(sizeof(*key), GFP_KERNEL);
        if (!key) {
                err = -ENOMEM;
                goto ice_vsi_cfg_rss_exit;
                err = -EIO;
        }
 
-       devm_kfree(&pf->pdev->dev, key);
+       kfree(key);
 ice_vsi_cfg_rss_exit:
-       devm_kfree(&pf->pdev->dev, lut);
+       kfree(lut);
        return err;
 }
 
  */
 int ice_vsi_manage_vlan_insertion(struct ice_vsi *vsi)
 {
-       struct device *dev = &vsi->back->pdev->dev;
        struct ice_hw *hw = &vsi->back->hw;
        struct ice_vsi_ctx *ctxt;
        enum ice_status status;
        int ret = 0;
 
-       ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
 
        status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
        if (status) {
-               dev_err(dev, "update VSI for VLAN insert failed, err %d aq_err %d\n",
+               dev_err(&vsi->back->pdev->dev, "update VSI for VLAN insert failed, err %d aq_err %d\n",
                        status, hw->adminq.sq_last_status);
                ret = -EIO;
                goto out;
 
        vsi->info.vlan_flags = ctxt->info.vlan_flags;
 out:
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return ret;
 }
 
  */
 int ice_vsi_manage_vlan_stripping(struct ice_vsi *vsi, bool ena)
 {
-       struct device *dev = &vsi->back->pdev->dev;
        struct ice_hw *hw = &vsi->back->hw;
        struct ice_vsi_ctx *ctxt;
        enum ice_status status;
        int ret = 0;
 
-       ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
 
        status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
        if (status) {
-               dev_err(dev, "update VSI for VLAN strip failed, ena = %d err %d aq_err %d\n",
+               dev_err(&vsi->back->pdev->dev, "update VSI for VLAN strip failed, ena = %d err %d aq_err %d\n",
                        ena, status, hw->adminq.sq_last_status);
                ret = -EIO;
                goto out;
 
        vsi->info.vlan_flags = ctxt->info.vlan_flags;
 out:
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return ret;
 }
 
 int ice_cfg_vlan_pruning(struct ice_vsi *vsi, bool ena, bool vlan_promisc)
 {
        struct ice_vsi_ctx *ctxt;
-       struct device *dev;
        struct ice_pf *pf;
        int status;
 
                return -EINVAL;
 
        pf = vsi->back;
-       dev = &pf->pdev->dev;
-       ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
        vsi->info.sec_flags = ctxt->info.sec_flags;
        vsi->info.sw_flags2 = ctxt->info.sw_flags2;
 
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return 0;
 
 err_out:
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return -EIO;
 }
 
        vsi->tc_cfg.ena_tc = ena_tc;
        vsi->tc_cfg.numtc = num_tc;
 
-       ctx = devm_kzalloc(&pf->pdev->dev, sizeof(*ctx), GFP_KERNEL);
+       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
                return -ENOMEM;
 
 
        ice_vsi_cfg_netdev_tc(vsi, ena_tc);
 out:
-       devm_kfree(&pf->pdev->dev, ctx);
+       kfree(ctx);
        return ret;
 }
 #endif /* CONFIG_DCB */
 
                an = "False";
 
        /* Get FEC mode requested based on PHY caps last SW configuration */
-       caps = devm_kzalloc(&vsi->back->pdev->dev, sizeof(*caps), GFP_KERNEL);
+       caps = kzalloc(sizeof(*caps), GFP_KERNEL);
        if (!caps) {
                fec_req = "Unknown";
                goto done;
        else
                fec_req = "NONE";
 
-       devm_kfree(&vsi->back->pdev->dev, caps);
+       kfree(caps);
 
 done:
        netdev_info(vsi->netdev, "NIC Link is up %sbps, Requested FEC: %s, FEC: %s, Autoneg: %s, Flow Control: %s\n",
        }
 
        event.buf_len = cq->rq_buf_size;
-       event.msg_buf = devm_kzalloc(&pf->pdev->dev, event.buf_len,
-                                    GFP_KERNEL);
+       event.msg_buf = kzalloc(event.buf_len, GFP_KERNEL);
        if (!event.msg_buf)
                return 0;
 
                }
        } while (pending && (i++ < ICE_DFLT_IRQ_WORK));
 
-       devm_kfree(&pf->pdev->dev, event.msg_buf);
+       kfree(event.msg_buf);
 
        return pending && (i == ICE_DFLT_IRQ_WORK);
 }
 
        pi = vsi->port_info;
 
-       pcaps = devm_kzalloc(dev, sizeof(*pcaps), GFP_KERNEL);
+       pcaps = kzalloc(sizeof(*pcaps), GFP_KERNEL);
        if (!pcaps)
                return -ENOMEM;
 
            link_up == !!(pi->phy.link_info.link_info & ICE_AQ_LINK_UP))
                goto out;
 
-       cfg = devm_kzalloc(dev, sizeof(*cfg), GFP_KERNEL);
+       cfg = kzalloc(sizeof(*cfg), GFP_KERNEL);
        if (!cfg) {
                retcode = -ENOMEM;
                goto out;
                retcode = -EIO;
        }
 
-       devm_kfree(dev, cfg);
+       kfree(cfg);
 out:
-       devm_kfree(dev, pcaps);
+       kfree(pcaps);
        return retcode;
 }
 
  */
 static int ice_vsi_update_bridge_mode(struct ice_vsi *vsi, u16 bmode)
 {
-       struct device *dev = &vsi->back->pdev->dev;
        struct ice_aqc_vsi_props *vsi_props;
        struct ice_hw *hw = &vsi->back->hw;
        struct ice_vsi_ctx *ctxt;
 
        vsi_props = &vsi->info;
 
-       ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
 
        status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
        if (status) {
-               dev_err(dev, "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n",
+               dev_err(&vsi->back->pdev->dev, "update VSI for bridge mode failed, bmode = %d err %d aq_err %d\n",
                        bmode, status, hw->adminq.sq_last_status);
                ret = -EIO;
                goto out;
        vsi_props->sw_flags = ctxt->info.sw_flags;
 
 out:
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return ret;
 }
 
 
  */
 static int ice_vsi_manage_pvid(struct ice_vsi *vsi, u16 vid, bool enable)
 {
-       struct device *dev = &vsi->back->pdev->dev;
        struct ice_hw *hw = &vsi->back->hw;
        struct ice_vsi_ctx *ctxt;
        enum ice_status status;
        int ret = 0;
 
-       ctxt = devm_kzalloc(dev, sizeof(*ctxt), GFP_KERNEL);
+       ctxt = kzalloc(sizeof(*ctxt), GFP_KERNEL);
        if (!ctxt)
                return -ENOMEM;
 
 
        status = ice_update_vsi(hw, vsi->idx, ctxt, NULL);
        if (status) {
-               dev_info(dev, "update VSI for port VLAN failed, err %d aq_err %d\n",
+               dev_info(&vsi->back->pdev->dev, "update VSI for port VLAN failed, err %d aq_err %d\n",
                         status, hw->adminq.sq_last_status);
                ret = -EIO;
                goto out;
 
        vsi->info = ctxt->info;
 out:
-       devm_kfree(dev, ctxt);
+       kfree(ctxt);
        return ret;
 }
 
 
        len = sizeof(struct virtchnl_vf_resource);
 
-       vfres = devm_kzalloc(&pf->pdev->dev, len, GFP_KERNEL);
+       vfres = kzalloc(len, GFP_KERNEL);
        if (!vfres) {
                v_ret = VIRTCHNL_STATUS_ERR_NO_MEMORY;
                len = 0;
        ret = ice_vc_send_msg_to_vf(vf, VIRTCHNL_OP_GET_VF_RESOURCES, v_ret,
                                    (u8 *)vfres, len);
 
-       devm_kfree(&pf->pdev->dev, vfres);
+       kfree(vfres);
        return ret;
 }
 
                return 0;
        }
 
-       ctx = devm_kzalloc(&pf->pdev->dev, sizeof(*ctx), GFP_KERNEL);
+       ctx = kzalloc(sizeof(*ctx), GFP_KERNEL);
        if (!ctx)
                return -ENOMEM;
 
        vsi->info.sec_flags = ctx->info.sec_flags;
        vsi->info.sw_flags2 = ctx->info.sw_flags2;
 out:
-       devm_kfree(&pf->pdev->dev, ctx);
+       kfree(ctx);
        return ret;
 }