Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

i2c: ali15x3: Fix an error handling path in ali15x3_probe()

If i2c_add_adapter() fails, the request_region() call in ali15x3_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>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/9b2090cbcc02659f425188ea05f2e02745c4e67b.1741031878.git.christophe.jaillet@wanadoo.fr

authored by

Christophe JAILLET and committed by
Andi Shyti
6e55caaf 9b5463f3

+11 -1
+11 -1
drivers/i2c/busses/i2c-ali15x3.c
··· 472 472 473 473 static int ali15x3_probe(struct pci_dev *dev, const struct pci_device_id *id) 474 474 { 475 + int ret; 476 + 475 477 if (ali15x3_setup(dev)) { 476 478 dev_err(&dev->dev, 477 479 "ALI15X3 not detected, module not inserted.\n"); ··· 485 483 486 484 snprintf(ali15x3_adapter.name, sizeof(ali15x3_adapter.name), 487 485 "SMBus ALI15X3 adapter at %04x", ali15x3_smba); 488 - return i2c_add_adapter(&ali15x3_adapter); 486 + ret = i2c_add_adapter(&ali15x3_adapter); 487 + if (ret) 488 + goto release_region; 489 + 490 + return 0; 491 + 492 + release_region: 493 + release_region(ali15x3_smba, ALI15X3_SMB_IOSIZE); 494 + return ret; 489 495 } 490 496 491 497 static void ali15x3_remove(struct pci_dev *dev)