Commit 77ed84f4 authored by Bruce Allan's avatar Bruce Allan Committed by Jeff Kirsher

ice: avoid multiple unnecessary de-references in probe

Add a local variable struct device *dev to avoid unnecessary de-references
throughout ice_probe().
Signed-off-by: default avatarBruce Allan <bruce.w.allan@intel.com>
Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 42b2cc83
...@@ -2075,6 +2075,7 @@ static void ice_verify_cacheline_size(struct ice_pf *pf) ...@@ -2075,6 +2075,7 @@ static void ice_verify_cacheline_size(struct ice_pf *pf)
static int ice_probe(struct pci_dev *pdev, static int ice_probe(struct pci_dev *pdev,
const struct pci_device_id __always_unused *ent) const struct pci_device_id __always_unused *ent)
{ {
struct device *dev = &pdev->dev;
struct ice_pf *pf; struct ice_pf *pf;
struct ice_hw *hw; struct ice_hw *hw;
int err; int err;
...@@ -2086,20 +2087,20 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2086,20 +2087,20 @@ static int ice_probe(struct pci_dev *pdev,
err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), pci_name(pdev)); err = pcim_iomap_regions(pdev, BIT(ICE_BAR0), pci_name(pdev));
if (err) { if (err) {
dev_err(&pdev->dev, "BAR0 I/O map error %d\n", err); dev_err(dev, "BAR0 I/O map error %d\n", err);
return err; return err;
} }
pf = devm_kzalloc(&pdev->dev, sizeof(*pf), GFP_KERNEL); pf = devm_kzalloc(dev, sizeof(*pf), GFP_KERNEL);
if (!pf) if (!pf)
return -ENOMEM; return -ENOMEM;
/* set up for high or low dma */ /* set up for high or low dma */
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64));
if (err) if (err)
err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); err = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32));
if (err) { if (err) {
dev_err(&pdev->dev, "DMA configuration failed: 0x%x\n", err); dev_err(dev, "DMA configuration failed: 0x%x\n", err);
return err; return err;
} }
...@@ -2133,12 +2134,12 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2133,12 +2134,12 @@ static int ice_probe(struct pci_dev *pdev,
err = ice_init_hw(hw); err = ice_init_hw(hw);
if (err) { if (err) {
dev_err(&pdev->dev, "ice_init_hw failed: %d\n", err); dev_err(dev, "ice_init_hw failed: %d\n", err);
err = -EIO; err = -EIO;
goto err_exit_unroll; goto err_exit_unroll;
} }
dev_info(&pdev->dev, "firmware %d.%d.%05d api %d.%d\n", dev_info(dev, "firmware %d.%d.%05d api %d.%d\n",
hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build, hw->fw_maj_ver, hw->fw_min_ver, hw->fw_build,
hw->api_maj_ver, hw->api_min_ver); hw->api_maj_ver, hw->api_min_ver);
...@@ -2152,8 +2153,8 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2152,8 +2153,8 @@ static int ice_probe(struct pci_dev *pdev,
goto err_init_pf_unroll; goto err_init_pf_unroll;
} }
pf->vsi = devm_kcalloc(&pdev->dev, pf->num_alloc_vsi, pf->vsi = devm_kcalloc(dev, pf->num_alloc_vsi, sizeof(*pf->vsi),
sizeof(*pf->vsi), GFP_KERNEL); GFP_KERNEL);
if (!pf->vsi) { if (!pf->vsi) {
err = -ENOMEM; err = -ENOMEM;
goto err_init_pf_unroll; goto err_init_pf_unroll;
...@@ -2161,8 +2162,7 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2161,8 +2162,7 @@ static int ice_probe(struct pci_dev *pdev,
err = ice_init_interrupt_scheme(pf); err = ice_init_interrupt_scheme(pf);
if (err) { if (err) {
dev_err(&pdev->dev, dev_err(dev, "ice_init_interrupt_scheme failed: %d\n", err);
"ice_init_interrupt_scheme failed: %d\n", err);
err = -EIO; err = -EIO;
goto err_init_interrupt_unroll; goto err_init_interrupt_unroll;
} }
...@@ -2178,15 +2178,13 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2178,15 +2178,13 @@ static int ice_probe(struct pci_dev *pdev,
if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) { if (test_bit(ICE_FLAG_MSIX_ENA, pf->flags)) {
err = ice_req_irq_msix_misc(pf); err = ice_req_irq_msix_misc(pf);
if (err) { if (err) {
dev_err(&pdev->dev, dev_err(dev, "setup of misc vector failed: %d\n", err);
"setup of misc vector failed: %d\n", err);
goto err_init_interrupt_unroll; goto err_init_interrupt_unroll;
} }
} }
/* create switch struct for the switch element created by FW on boot */ /* create switch struct for the switch element created by FW on boot */
pf->first_sw = devm_kzalloc(&pdev->dev, sizeof(*pf->first_sw), pf->first_sw = devm_kzalloc(dev, sizeof(*pf->first_sw), GFP_KERNEL);
GFP_KERNEL);
if (!pf->first_sw) { if (!pf->first_sw) {
err = -ENOMEM; err = -ENOMEM;
goto err_msix_misc_unroll; goto err_msix_misc_unroll;
...@@ -2204,8 +2202,7 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2204,8 +2202,7 @@ static int ice_probe(struct pci_dev *pdev,
err = ice_setup_pf_sw(pf); err = ice_setup_pf_sw(pf);
if (err) { if (err) {
dev_err(&pdev->dev, dev_err(dev, "probe failed due to setup pf switch:%d\n", err);
"probe failed due to setup pf switch:%d\n", err);
goto err_alloc_sw_unroll; goto err_alloc_sw_unroll;
} }
...@@ -2227,7 +2224,7 @@ static int ice_probe(struct pci_dev *pdev, ...@@ -2227,7 +2224,7 @@ static int ice_probe(struct pci_dev *pdev,
ice_free_irq_msix_misc(pf); ice_free_irq_msix_misc(pf);
err_init_interrupt_unroll: err_init_interrupt_unroll:
ice_clear_interrupt_scheme(pf); ice_clear_interrupt_scheme(pf);
devm_kfree(&pdev->dev, pf->vsi); devm_kfree(dev, pf->vsi);
err_init_pf_unroll: err_init_pf_unroll:
ice_deinit_pf(pf); ice_deinit_pf(pf);
ice_deinit_hw(hw); ice_deinit_hw(hw);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment