Re: [PATCH v1 1/1] serial: 8250_port: Drop duplicate NULL check
From: Andy Shevchenko
Date: Tue Mar 03 2026 - 03:31:40 EST
On Tue, Mar 03, 2026 at 09:55:45AM +0200, Andy Shevchenko wrote:
> On Tue, Mar 03, 2026 at 06:25:29AM +0100, Jiri Slaby wrote:
> > On 02. 03. 26, 16:27, Andy Shevchenko wrote:
> > > serial8250_release_dma() is NULL-aware, no need to check this in the caller.
> > > While at it, make sure DMA won't be used again, by NULLifying the pointer.
...
> > > - if (up->dma)
> > > - serial8250_release_dma(up);
> > > + serial8250_release_dma(up);
> > > + up->dma = NULL;
> >
> > Shouldn't serial8250_release_dma() NULL it instead, so the callers need not
> > to bother?
>
> I copied what 8250_omap is doing. But we can do what you suggested I think.
I looked at the 8250_dma code and serial8250_release_dma() in particular,
and I think I am not going to change the approach. The 'dma' pointer is
assigned outside of serial8250_request_dma() and NULLifying it in
serial8250_release_dma() will be a layering violation.
--
With Best Regards,
Andy Shevchenko