Skip to content

Commit

Permalink
i2c: pxa-pci: fix missing pci_disable_device() on error in ce4100_i2c…
Browse files Browse the repository at this point in the history
…_probe

[ Upstream commit d78a167 ]

Using pcim_enable_device() to avoid missing pci_disable_device().

Fixes: 7e94dd1 ("i2c-pxa2xx: Add PCI support for PXA I2C controller")
Signed-off-by: Hui Tang <tanghui20@huawei.com>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Hui Tang authored and gregkh committed Dec 31, 2022
1 parent ba090c6 commit c8889af
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions drivers/i2c/busses/i2c-pxa-pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ static int ce4100_i2c_probe(struct pci_dev *dev,
int i;
struct ce4100_devices *sds;

ret = pci_enable_device_mem(dev);
ret = pcim_enable_device(dev);
if (ret)
return ret;

Expand All @@ -114,10 +114,8 @@ static int ce4100_i2c_probe(struct pci_dev *dev,
return -EINVAL;
}
sds = kzalloc(sizeof(*sds), GFP_KERNEL);
if (!sds) {
ret = -ENOMEM;
goto err_mem;
}
if (!sds)
return -ENOMEM;

for (i = 0; i < ARRAY_SIZE(sds->pdev); i++) {
sds->pdev[i] = add_i2c_device(dev, i);
Expand All @@ -133,8 +131,6 @@ static int ce4100_i2c_probe(struct pci_dev *dev,

err_dev_add:
kfree(sds);
err_mem:
pci_disable_device(dev);
return ret;
}

Expand Down

0 comments on commit c8889af

Please sign in to comment.