public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe()
@ 2025-05-13 17:56 Christophe JAILLET
  2025-05-14  7:25 ` Jarkko Nikula
  2025-05-14 15:31 ` Andi Shyti
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe JAILLET @ 2025-05-13 17:56 UTC (permalink / raw)
  To: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Jan Dabros,
	Andi Shyti, Sanket Goswami, Wolfram Sang, Shyam Sundar S K,
	Nehal Bakulchandra Shah
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET, linux-i2c

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>
---
 drivers/i2c/busses/i2c-designware-pcidrv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
index 8e0267c7cc29..f21f9877c040 100644
--- a/drivers/i2c/busses/i2c-designware-pcidrv.c
+++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
@@ -278,9 +278,11 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
 
 	if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) {
 		dev->slave = i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, &dgpu_node);
-		if (IS_ERR(dev->slave))
+		if (IS_ERR(dev->slave)) {
+			i2c_del_adapter(&dev->adapter);
 			return dev_err_probe(device, PTR_ERR(dev->slave),
 					     "register UCSI failed\n");
+		}
 	}
 
 	pm_runtime_set_autosuspend_delay(device, 1000);
-- 
2.49.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe()
  2025-05-13 17:56 [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe() Christophe JAILLET
@ 2025-05-14  7:25 ` Jarkko Nikula
  2025-05-14 15:31 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Nikula @ 2025-05-14  7:25 UTC (permalink / raw)
  To: Christophe JAILLET, Andy Shevchenko, Mika Westerberg, Jan Dabros,
	Andi Shyti, Sanket Goswami, Wolfram Sang, Shyam Sundar S K,
	Nehal Bakulchandra Shah
  Cc: linux-kernel, kernel-janitors, linux-i2c

On 5/13/25 8:56 PM, Christophe JAILLET wrote:
> 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>
> ---
>   drivers/i2c/busses/i2c-designware-pcidrv.c | 4 +++-
>   1 file changed, 3 insertions(+), 1 deletion(-)
> 
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe()
  2025-05-13 17:56 [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe() Christophe JAILLET
  2025-05-14  7:25 ` Jarkko Nikula
@ 2025-05-14 15:31 ` Andi Shyti
  1 sibling, 0 replies; 3+ messages in thread
From: Andi Shyti @ 2025-05-14 15:31 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Jan Dabros,
	Sanket Goswami, Wolfram Sang, Shyam Sundar S K,
	Nehal Bakulchandra Shah, linux-kernel, kernel-janitors, linux-i2c

Hi Christophe,

On Tue, May 13, 2025 at 07:56:41PM +0200, Christophe JAILLET wrote:
> 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>

merged to i2c/i2c-host-fixes.

Thanks,
Andi

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-05-14 15:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-05-13 17:56 [PATCH] i2c: designware: Fix an error handling path in i2c_dw_pci_probe() Christophe JAILLET
2025-05-14  7:25 ` Jarkko Nikula
2025-05-14 15:31 ` Andi Shyti

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox