diff mbox series

i2c: i801: unregister tco_pdev in i801_probe() error path

Message ID 458b1c8b-1885-6583-f45d-7548ce65bb33@gmail.com
State New
Headers show
Series i2c: i801: unregister tco_pdev in i801_probe() error path | expand

Commit Message

Heiner Kallweit Sept. 14, 2023, 9:08 p.m. UTC
We have to unregister tco_pdev also if i2c_add_adapter() fails.

Fixes: 9424693035a5 ("i2c: i801: Create iTCO device on newer Intel PCHs")
Cc: stable@vger.kernel.org
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/i2c/busses/i2c-i801.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Mika Westerberg Sept. 15, 2023, 4:55 a.m. UTC | #1
On Thu, Sep 14, 2023 at 11:08:44PM +0200, Heiner Kallweit wrote:
> We have to unregister tco_pdev also if i2c_add_adapter() fails.
> 
> Fixes: 9424693035a5 ("i2c: i801: Create iTCO device on newer Intel PCHs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Wolfram Sang Sept. 19, 2023, 9:03 a.m. UTC | #2
On Thu, Sep 14, 2023 at 11:08:44PM +0200, Heiner Kallweit wrote:
> We have to unregister tco_pdev also if i2c_add_adapter() fails.
> 
> Fixes: 9424693035a5 ("i2c: i801: Create iTCO device on newer Intel PCHs")
> Cc: stable@vger.kernel.org
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Applied to for-current, thanks!
diff mbox series

Patch

diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index f53be242f..9bd712eaf 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -1753,6 +1753,7 @@  static int i801_probe(struct pci_dev *dev, const struct pci_device_id *id)
 		"SMBus I801 adapter at %04lx", priv->smba);
 	err = i2c_add_adapter(&priv->adapter);
 	if (err) {
+		platform_device_unregister(priv->tco_pdev);
 		i801_acpi_remove(priv);
 		return err;
 	}