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

i2c: designware: Fix an error handling path in i2c_dw_pci_probe()

If navi_amd_register_client() fails, the previous i2c_dw_probe() call
should be undone by a corresponding i2c_del_adapter() call, as already done
in the remove function.

Fixes: 17631e8ca2d3 ("i2c: designware: Add driver support for AMD NAVI GPU")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: <stable@vger.kernel.org> # v5.13+
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/fcd9651835a32979df8802b2db9504c523a8ebbb.1747158983.git.christophe.jaillet@wanadoo.fr

authored by

Christophe JAILLET and committed by
Andi Shyti
1cfe51ef 82f2b0b9

+3 -1
+3 -1
drivers/i2c/busses/i2c-designware-pcidrv.c
··· 278 278 279 279 if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) { 280 280 dev->slave = i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, &dgpu_node); 281 - if (IS_ERR(dev->slave)) 281 + if (IS_ERR(dev->slave)) { 282 + i2c_del_adapter(&dev->adapter); 282 283 return dev_err_probe(device, PTR_ERR(dev->slave), 283 284 "register UCSI failed\n"); 285 + } 284 286 } 285 287 286 288 pm_runtime_set_autosuspend_delay(device, 1000);