serial: 8250_port: Drop duplicate NULL check
PATCH 1/1 serial: 8250_port: Drop duplicate NULL check
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.
--- drivers/tty/serial/8250/8250_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/8250/8250_port.c +2 -2
@@ -2366,8 +2366,8 @@ void serial8250_do_shutdown(struct uart_port *port)synchronize_irq (port->irq); -if (up->dma) -serial8250_release_dma (up); +serial8250_release_dma (up); + up->dma =NULL ; scoped_guard(uart_port_lock_irqsave, port) {if (port->flags &UPF_FOURPORT ) {
Signature · 1 line
2.50.1
Jiri Slaby
maintainerQuoted 13 lines · Andy Shevchenko
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.Signed-off-by Andy Shevchenko <[email protected]>--- drivers/tty/serial/8250/8250_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/tty/serial/8250/8250_port.c +0
-0
drivers/tty/serial/8250/8250_port.c void serial8250_do_shutdown(struct uart_port *port) · line 2370
Quoted 7 lines
drivers/tty/serial/8250/8250_port.c +2
-2@@ -2366,8 +2366,8 @@ void serial8250_do_shutdown(struct uart_port *port)synchronize_irq (port->irq); -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?
thanks,
Signature · 2 lines
js suse labs
Quoted 4 lines · Jiri Slaby
Quoted 2 lines · Andy Shevchenko
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.
Quoted 8 lines
drivers/tty/serial/8250/8250_port.c void serial8250_do_shutdown(struct uart_port *port) · line 2370
Quoted 5 lines
synchronize_irq(port->irq);drivers/tty/serial/8250/8250_port.c +2
-2-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.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 4 lines · Andy Shevchenko
Quoted 3 lines · Jiri Slaby
Quoted 2 lines · Andy Shevchenko
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.
...
Quoted 9 lines
Quoted 7 lines
drivers/tty/serial/8250/8250_port.c void serial8250_do_shutdown(struct uart_port *port) · line 2370
Quoted 4 lines
drivers/tty/serial/8250/8250_port.c +2
-2-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.
Signature · 2 lines
With Best Regards, Andy Shevchenko