Re: [PATCH] i2c: i801: unregister tco_pdev in i801_probe() error path

Jean Delvare
2023-09-17T17:34:29Z

On Thu, 14 Sep 2023 23:08:44 +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>
> ---
> drivers/i2c/busses/i2c-i801.c | 1 +
> 1 file changed, 1 insertion(+)
>
> 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;
> }

Reviewed-by: Jean Delvare <jdelvare@suse.de>

--
Jean Delvare
SUSE L3 Support