diff mbox series

[2/2] USB: serial: ti_usb_3410_5052: clean up serial data access

Message ID 20191011095736.21934-2-johan@kernel.org (mailing list archive)
State Mainlined
Commit bc25770f00d3f4e7482278f9823c2c2793605484
Headers show
Series [1/2] USB: serial: ti_usb_3410_5052: fix port-close races | expand

Commit Message

Johan Hovold Oct. 11, 2019, 9:57 a.m. UTC
Use the tdev pointer directly instead of going through the port data
when accessing the serial data in open().

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/usb/serial/ti_usb_3410_5052.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Johan Hovold Oct. 11, 2019, 10 a.m. UTC | #1
On Fri, Oct 11, 2019 at 11:57:36AM +0200, Johan Hovold wrote:
> Use the tdev pointer directly instead of going through the port data
> when accessing the serial data in open().

hmm, s/open/close/.

> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
>  drivers/usb/serial/ti_usb_3410_5052.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
> index 9174ba2e06da..ef23acc9b9ce 100644
> --- a/drivers/usb/serial/ti_usb_3410_5052.c
> +++ b/drivers/usb/serial/ti_usb_3410_5052.c
> @@ -800,8 +800,8 @@ static void ti_close(struct usb_serial_port *port)
>  							, __func__, status);
>  
>  	mutex_lock(&tdev->td_open_close_lock);
> -	--tport->tp_tdev->td_open_port_count;
> -	if (tport->tp_tdev->td_open_port_count == 0) {
> +	--tdev->td_open_port_count;
> +	if (tdev->td_open_port_count == 0) {
>  		/* last port is closed, shut down interrupt urb */
>  		usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
>  	}

Johan
diff mbox series

Patch

diff --git a/drivers/usb/serial/ti_usb_3410_5052.c b/drivers/usb/serial/ti_usb_3410_5052.c
index 9174ba2e06da..ef23acc9b9ce 100644
--- a/drivers/usb/serial/ti_usb_3410_5052.c
+++ b/drivers/usb/serial/ti_usb_3410_5052.c
@@ -800,8 +800,8 @@  static void ti_close(struct usb_serial_port *port)
 							, __func__, status);
 
 	mutex_lock(&tdev->td_open_close_lock);
-	--tport->tp_tdev->td_open_port_count;
-	if (tport->tp_tdev->td_open_port_count == 0) {
+	--tdev->td_open_port_count;
+	if (tdev->td_open_port_count == 0) {
 		/* last port is closed, shut down interrupt urb */
 		usb_kill_urb(port->serial->port[0]->interrupt_in_urb);
 	}