Skip to content

Commit 2b22459

Browse files
tititiou36Andi Shyti
authored andcommitted
i2c: sis630: Fix an error handling path in sis630_probe()
If i2c_add_adapter() fails, the request_region() call in sis630_setup() must be undone by a corresponding release_region() call, as done in the remove function. Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Link: https://lore.kernel.org/r/3d607601f2c38e896b10207963c6ab499ca5c307.1741033587.git.christophe.jaillet@wanadoo.fr Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
1 parent 6e55caa commit 2b22459

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

drivers/i2c/busses/i2c-sis630.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,8 @@ MODULE_DEVICE_TABLE(pci, sis630_ids);
509509

510510
static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
511511
{
512+
int ret;
513+
512514
if (sis630_setup(dev)) {
513515
dev_err(&dev->dev,
514516
"SIS630 compatible bus not detected, "
@@ -522,7 +524,15 @@ static int sis630_probe(struct pci_dev *dev, const struct pci_device_id *id)
522524
snprintf(sis630_adapter.name, sizeof(sis630_adapter.name),
523525
"SMBus SIS630 adapter at %04x", smbus_base + SMB_STS);
524526

525-
return i2c_add_adapter(&sis630_adapter);
527+
ret = i2c_add_adapter(&sis630_adapter);
528+
if (ret)
529+
goto release_region;
530+
531+
return 0;
532+
533+
release_region:
534+
release_region(smbus_base + SMB_STS, SIS630_SMB_IOREGION);
535+
return ret;
526536
}
527537

528538
static void sis630_remove(struct pci_dev *dev)

0 commit comments

Comments
 (0)