Skip to contentSkip to conversation

i2c-pxa2xx: fix missing pci_disable_device() on error in ce4100_i2c_probe

PATCH In review Hui Tang 2 participants 2 messages Nov 14, 2022 – Dec 5, 2022 I2C subsystem host drivers

lore
Share & tools
lore

Hui Tang

author
#0 lore raw

PATCH 1/1 i2c-pxa2xx: fix missing pci_disable_device() on error in ce4100_i2c_probe

Using pcim_enable_device() to avoid missing pci_disable_device().

Fixes 7e94dd154e934 ("i2c-pxa2xx: Add PCI support for PXA I2C controller")
---
 drivers/i2c/busses/i2c-pxa-pci.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)
drivers/i2c/busses/i2c-pxa-pci.c +3 -7
index f614cade432b..30e38bc8b6db 100644
@@ -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;
 
@@ -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);
@@ -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;
 }
 
Signature · 1 line
2.17.1
#1 lore raw
Quoted 4 lines · Hui Tang

Using pcim_enable_device() to avoid missing pci_disable_device().

Fixes 7e94dd154e934 ("i2c-pxa2xx: Add PCI support for PXA I2C controller")

Fixed the subject to "i2c: pxa-pci:" and fixed this checkpatch warning:

WARNING: Please use correct Fixes: style 'Fixes: <12 chars of sha1> ("<title line>")' - ie: 'Fixes: 7e94dd154e93 ("i2c-pxa2xx: Add PCI support for PXA I2C controller")' #3:

Fixes 7e94dd154e934 ("i2c-pxa2xx: Add PCI support for PXA I2C controller")

Please do that in the future. After all that, applied to for-next, thanks!