Message ID | 20200826121437.31606-1-dinghao.liu@zju.edu.cn (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | EDAC: i5100_edac: Fix error handling code in i5100_init_one | expand |
On Wed, Aug 26, 2020 at 08:14:37PM +0800, Dinghao Liu wrote: > When pci_get_device_func() fails, we don't need to execute > pci_dev_put(). But mci should be freed to prevent memleak. > When pci_enable_device() fails, we don't need to disable > einj either. > > Fixes: 52608ba205461 ("i5100_edac: probe for device 19 function 0") > Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> > --- > drivers/edac/i5100_edac.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) Applied, thanks.
diff --git a/drivers/edac/i5100_edac.c b/drivers/edac/i5100_edac.c index 191aa7c19ded..410bbe55cd3f 100644 --- a/drivers/edac/i5100_edac.c +++ b/drivers/edac/i5100_edac.c @@ -1061,13 +1061,13 @@ static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id) PCI_DEVICE_ID_INTEL_5100_19, 0); if (!einj) { ret = -ENODEV; - goto bail_einj; + goto bail_free; } rc = pci_enable_device(einj); if (rc < 0) { ret = rc; - goto bail_disable_einj; + goto bail_einj; } @@ -1136,14 +1136,14 @@ static int i5100_init_one(struct pci_dev *pdev, const struct pci_device_id *id) bail_scrub: priv->scrub_enable = 0; cancel_delayed_work_sync(&(priv->i5100_scrubbing)); - edac_mc_free(mci); - -bail_disable_einj: pci_disable_device(einj); bail_einj: pci_dev_put(einj); +bail_free: + edac_mc_free(mci); + bail_disable_ch1: pci_disable_device(ch1mm);
When pci_get_device_func() fails, we don't need to execute pci_dev_put(). But mci should be freed to prevent memleak. When pci_enable_device() fails, we don't need to disable einj either. Fixes: 52608ba205461 ("i5100_edac: probe for device 19 function 0") Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn> --- drivers/edac/i5100_edac.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)