Skip to content

Commit 1cfe51e

Browse files
tititiou36Andi Shyti
authored andcommitted
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: 17631e8 ("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
1 parent 82f2b0b commit 1cfe51e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/i2c/busses/i2c-designware-pcidrv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,11 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
278278

279279
if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) {
280280
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);
282283
return dev_err_probe(device, PTR_ERR(dev->slave),
283284
"register UCSI failed\n");
285+
}
284286
}
285287

286288
pm_runtime_set_autosuspend_delay(device, 1000);

0 commit comments

Comments
 (0)