Re: [PATCH] i2c: atr: fix dangling adapter pointer on add failure
From: Linkai Gong
Date: Mon Sep 07 2026 - 03:09:45 EST
On Tue, Aug 11, 2026 at 05:36:13PM +0300, Andy Shevchenko wrote:
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> ...
>
> > if (ret) {
> > dev_err(dev, "failed to add atr-adapter %u (error=%d)\n",
> > chan_id, ret);
> > + atr->adapter[chan_id] = NULL;
>
> It's better to NULLify first and print after. This will reduce the window of
> possible calls with the stale pointer.
Agreed. I will send a v2 that clears the slot before the error print.
Thanks,
Linkai