* [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling [not found] <20210702134227.24621-1-johan@kernel.org> @ 2021-07-02 13:42 ` Johan Hovold 2021-07-02 14:47 ` Greg KH 2021-07-02 13:42 ` [PATCH 2/6] USB: serial: cp210x: fix flow-control " Johan Hovold 1 sibling, 1 reply; 4+ messages in thread From: Johan Hovold @ 2021-07-02 13:42 UTC (permalink / raw) To: Johan Hovold; +Cc: linux-usb, linux-kernel, stable In the unlikely event that setting the software flow-control characters fails the other flow-control settings should still be updated. Fixes: 7748feffcd80 ("USB: serial: cp210x: add support for software flow control") Cc: stable@vger.kernel.org # 5.11 Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/usb/serial/cp210x.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index 09b845d0da41..b41e2c7649fb 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -1217,9 +1217,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, chars.bXonChar = START_CHAR(tty); chars.bXoffChar = STOP_CHAR(tty); - ret = cp210x_set_chars(port, &chars); - if (ret) - return; + cp210x_set_chars(port, &chars); } mutex_lock(&port_priv->mutex); -- 2.31.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling 2021-07-02 13:42 ` [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling Johan Hovold @ 2021-07-02 14:47 ` Greg KH 2021-07-05 7:40 ` Johan Hovold 0 siblings, 1 reply; 4+ messages in thread From: Greg KH @ 2021-07-02 14:47 UTC (permalink / raw) To: Johan Hovold; +Cc: linux-usb, linux-kernel, stable On Fri, Jul 02, 2021 at 03:42:22PM +0200, Johan Hovold wrote: > In the unlikely event that setting the software flow-control characters > fails the other flow-control settings should still be updated. > > Fixes: 7748feffcd80 ("USB: serial: cp210x: add support for software flow control") > Cc: stable@vger.kernel.org # 5.11 > Signed-off-by: Johan Hovold <johan@kernel.org> > --- > drivers/usb/serial/cp210x.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c > index 09b845d0da41..b41e2c7649fb 100644 > --- a/drivers/usb/serial/cp210x.c > +++ b/drivers/usb/serial/cp210x.c > @@ -1217,9 +1217,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, > chars.bXonChar = START_CHAR(tty); > chars.bXoffChar = STOP_CHAR(tty); > > - ret = cp210x_set_chars(port, &chars); > - if (ret) > - return; > + cp210x_set_chars(port, &chars); What's the odds that someone tries to add the error checking back in here, in a few years? Can you put a comment here saying why you are not checking it? thanks, greg k-h ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling 2021-07-02 14:47 ` Greg KH @ 2021-07-05 7:40 ` Johan Hovold 0 siblings, 0 replies; 4+ messages in thread From: Johan Hovold @ 2021-07-05 7:40 UTC (permalink / raw) To: Greg KH; +Cc: linux-usb, linux-kernel, stable On Fri, Jul 02, 2021 at 04:47:11PM +0200, Greg Kroah-Hartman wrote: > On Fri, Jul 02, 2021 at 03:42:22PM +0200, Johan Hovold wrote: > > In the unlikely event that setting the software flow-control characters > > fails the other flow-control settings should still be updated. > > > > Fixes: 7748feffcd80 ("USB: serial: cp210x: add support for software flow control") > > Cc: stable@vger.kernel.org # 5.11 > > Signed-off-by: Johan Hovold <johan@kernel.org> > > --- > > drivers/usb/serial/cp210x.c | 4 +--- > > 1 file changed, 1 insertion(+), 3 deletions(-) > > > > diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c > > index 09b845d0da41..b41e2c7649fb 100644 > > --- a/drivers/usb/serial/cp210x.c > > +++ b/drivers/usb/serial/cp210x.c > > @@ -1217,9 +1217,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, > > chars.bXonChar = START_CHAR(tty); > > chars.bXoffChar = STOP_CHAR(tty); > > > > - ret = cp210x_set_chars(port, &chars); > > - if (ret) > > - return; > > + cp210x_set_chars(port, &chars); > > What's the odds that someone tries to add the error checking back in > here, in a few years? Can you put a comment here saying why you are not > checking it? This is just how set_termios() works and how the other requests are handled by the driver. I can add an explicit error message here though just like when setting the line-control register so that it doesn't look like an oversight. The error message is currently printed by the set_chars() helper, but I can move that out when removing the helper later in the series. Johan ^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 2/6] USB: serial: cp210x: fix flow-control error handling [not found] <20210702134227.24621-1-johan@kernel.org> 2021-07-02 13:42 ` [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling Johan Hovold @ 2021-07-02 13:42 ` Johan Hovold 1 sibling, 0 replies; 4+ messages in thread From: Johan Hovold @ 2021-07-02 13:42 UTC (permalink / raw) To: Johan Hovold; +Cc: linux-usb, linux-kernel, stable Make sure that the driver crtscts state is not updated in the unlikely event that the flow-control request fails. Not doing so could break RTS control. Fixes: 5951b8508855 ("USB: serial: cp210x: suppress modem-control errors") Cc: stable@vger.kernel.org # 5.11 Signed-off-by: Johan Hovold <johan@kernel.org> --- drivers/usb/serial/cp210x.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/serial/cp210x.c b/drivers/usb/serial/cp210x.c index b41e2c7649fb..eb3be4f65603 100644 --- a/drivers/usb/serial/cp210x.c +++ b/drivers/usb/serial/cp210x.c @@ -1191,6 +1191,7 @@ static void cp210x_set_flow_control(struct tty_struct *tty, struct cp210x_flow_ctl flow_ctl; u32 flow_repl; u32 ctl_hs; + bool crtscts; int ret; /* @@ -1246,14 +1247,14 @@ static void cp210x_set_flow_control(struct tty_struct *tty, flow_repl |= CP210X_SERIAL_RTS_FLOW_CTL; else flow_repl |= CP210X_SERIAL_RTS_INACTIVE; - port_priv->crtscts = true; + crtscts = true; } else { ctl_hs &= ~CP210X_SERIAL_CTS_HANDSHAKE; if (port_priv->rts) flow_repl |= CP210X_SERIAL_RTS_ACTIVE; else flow_repl |= CP210X_SERIAL_RTS_INACTIVE; - port_priv->crtscts = false; + crtscts = false; } if (I_IXOFF(tty)) { @@ -1276,8 +1277,12 @@ static void cp210x_set_flow_control(struct tty_struct *tty, flow_ctl.ulControlHandshake = cpu_to_le32(ctl_hs); flow_ctl.ulFlowReplace = cpu_to_le32(flow_repl); - cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, + ret = cp210x_write_reg_block(port, CP210X_SET_FLOW, &flow_ctl, sizeof(flow_ctl)); + if (ret) + goto out_unlock; + + port_priv->crtscts = crtscts; out_unlock: mutex_unlock(&port_priv->mutex); } -- 2.31.1 ^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-07-05 7:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20210702134227.24621-1-johan@kernel.org>
2021-07-02 13:42 ` [PATCH 1/6] USB: serial: cp210x: fix control-characters error handling Johan Hovold
2021-07-02 14:47 ` Greg KH
2021-07-05 7:40 ` Johan Hovold
2021-07-02 13:42 ` [PATCH 2/6] USB: serial: cp210x: fix flow-control " Johan Hovold
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox