Skip to content

Commit d78a167

Browse files
Hui Tangwsakernel
authored andcommitted
i2c: pxa-pci: fix missing pci_disable_device() on error in ce4100_i2c_probe
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 <[email protected]> Signed-off-by: Wolfram Sang <[email protected]>
1 parent 87ab726 commit d78a167

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

drivers/i2c/busses/i2c-pxa-pci.c

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ static int ce4100_i2c_probe(struct pci_dev *dev,
105105
int i;
106106
struct ce4100_devices *sds;
107107

108-
ret = pci_enable_device_mem(dev);
108+
ret = pcim_enable_device(dev);
109109
if (ret)
110110
return ret;
111111

@@ -114,10 +114,8 @@ static int ce4100_i2c_probe(struct pci_dev *dev,
114114
return -EINVAL;
115115
}
116116
sds = kzalloc(sizeof(*sds), GFP_KERNEL);
117-
if (!sds) {
118-
ret = -ENOMEM;
119-
goto err_mem;
120-
}
117+
if (!sds)
118+
return -ENOMEM;
121119

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

134132
err_dev_add:
135133
kfree(sds);
136-
err_mem:
137-
pci_disable_device(dev);
138134
return ret;
139135
}
140136

0 commit comments

Comments
 (0)