serial: sccnxp: Improve verify_port
PATCH v2 1/1 serial: sccnxp: Improve verify_port
The patch improves verify_port procedure by comparing the type of port and IRQ numbers simultaneously. This can be important in the case of multiple drivers SCCNXP in the system that are different IRQs.
--- drivers/tty/serial/sccnxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/tty/serial/sccnxp.c +2 -2
@@ -713,8 +713,8 @@ static void sccnxp_config_port(struct uart_port *port, int flags)static int sccnxp_verify_port (struct uart_port *port,struct serial_struct *s) { -if ((s->type ==PORT_UNKNOWN ) || (s->type ==PORT_SC26XX )) -return 0 ; +if ((s->type !=PORT_UNKNOWN ) && (s->type !=PORT_SC26XX )) +return -EINVAL ;if (s->irq == port->irq)return 0 ;
Signature · 1 line
1.8.1.5
Greg Kroah-Hartman
maintainerQuoted 3 lines · Alexander Shiyan
The patch improves
verify_portprocedure by comparing the type of port and IRQ numbers simultaneously. This can be important in the case of multiple drivers SCCNXP in the system that are different IRQs.
So this fixes a bug? Really?
Quoted 10 lines
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/tty/serial/sccnxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/tty/serial/sccnxp.c +0
-0
drivers/tty/serial/sccnxp.c static void sccnxp_config_port(struct uart_port *port, int flags) · line 717
Quoted 7 lines
drivers/tty/serial/sccnxp.c +2
-2@@ -713,8 +713,8 @@ static void sccnxp_config_port(struct uart_port *port, int flags)static int sccnxp_verify_port (struct uart_port *port,struct serial_struct *s) { -if ((s->type ==PORT_UNKNOWN ) || (s->type ==PORT_SC26XX )) -return 0 ; +if ((s->type !=PORT_UNKNOWN ) && (s->type !=PORT_SC26XX )) +return -EINVAL ;
Why are you now returning a different value?
thanks,
greg k-h
Quoted 6 lines · Alexander Shiyan
Quoted 3 lines
The patch improves
verify_portprocedure by comparing the type of port and IRQ numbers simultaneously. This can be important in the case of multiple drivers SCCNXP in the system that are different IRQs.So this fixes a bug? Really?
Only in theory.
Quoted 11 lines
Quoted 11 lines
Signed-off-by Alexander Shiyan <[email protected]>--- drivers/tty/serial/sccnxp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/tty/serial/sccnxp.c +0
-0@@ -713,8 +713,8 @@ static void sccnxp_config_port(struct uart_port *port, int flags)
Quoted 8 lines
drivers/tty/serial/sccnxp.c static void sccnxp_config_port(struct uart_port *port, int flags) · line 717
Quoted 6 lines
drivers/tty/serial/sccnxp.c +2
-2static int sccnxp_verify_port (struct uart_port *port,struct serial_struct *s) { -if ((s->type ==PORT_UNKNOWN ) || (s->type ==PORT_SC26XX )) -return 0 ; +if ((s->type !=PORT_UNKNOWN ) && (s->type !=PORT_SC26XX )) +return -EINVAL ;Why are you now returning a different value?
Value is not different. Patch just change logic a bit. Zero on success, same as before.
---
Greg Kroah-Hartman
maintainerQuoted 8 lines · Alexander Shiyan
Quoted 6 lines · Alexander Shiyan
Quoted 3 lines
The patch improves
verify_portprocedure by comparing the type of port and IRQ numbers simultaneously. This can be important in the case of multiple drivers SCCNXP in the system that are different IRQs.So this fixes a bug? Really?
Only in theory.
How? It really doesn't look like you are doing anything here, except rearranging the logic to look different, but yet do the same thing.
So again, why are you doing this?
greg k-h
Quoted 11 lines
Quoted 8 lines
Quoted 6 lines · Alexander Shiyan
Quoted 3 lines
The patch improves
verify_portprocedure by comparing the type of port and IRQ numbers simultaneously. This can be important in the case of multiple drivers SCCNXP in the system that are different IRQs.So this fixes a bug? Really?
Only in theory.
How? It really doesn't look like you are doing anything here, except rearranging the logic to look different, but yet do the same thing.
Procedure do not compare IRQ before if port type is valid.
Quoted 1 line
So again, why are you doing this?
Well, just drop this patch. I cannot say more than now.
---