]> git.baikalelectronics.ru Git - kernel.git/commitdiff
i2c: i801: unregister tco_pdev in i801_probe() error path
authorHeiner Kallweit <hkallweit1@gmail.com>
Thu, 14 Sep 2023 21:08:44 +0000 (23:08 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Oct 2023 12:57:02 +0000 (14:57 +0200)
commit 3914784553f68c931fc666dbe7e86fe881aada38 upstream.

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>
Reviewed-by: Jean Delvare <jdelvare@suse.de>
Signed-off-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/i2c/busses/i2c-i801.c

index 1fda1eaa6d6ab0560ffbe2cfdca79cd7a7d887c6..da1f6b60f9c9a809c4a75a594a9d1e41319e7c67 100644 (file)
@@ -1754,6 +1754,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;
        }