Re: [PATCH] i2c: amd-mp2: Unregister callback on adapter add failure

From: Andi Shyti

Date: Fri Jul 24 2026 - 19:03:43 EST


Hi Myeonghun,

On Tue, Jul 21, 2026 at 11:41:47PM +0900, Myeonghun Pak wrote:
> amd_mp2_register_cb() stores the platform I2C context in the MP2 PCI
> driver's callback table before the adapter is registered. If
> i2c_add_adapter() fails, probe returns and devres frees the context,
> but the PCI driver can still dereference the stale pointer from its IRQ
> and system-sleep callbacks.
>
> Unregister the callback before returning the adapter registration error.
>
> Fixes: 529766e0a011 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")
> Cc: stable@xxxxxxxxxxxxxxx
> Co-developed-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Ijae Kim <ae878000@xxxxxxxxx>
> Signed-off-by: Myeonghun Pak <mhun512@xxxxxxxxx>

merged to i2c/i2c-fixes.

Thanks,
Andi