tty: n_gsm: delete DISC command frame as requester
PATCH v3 1/1 tty: n_gsm: delete DISC command frame as requester
From: Zhenguo Zhao <[email protected]>
as initiator,it need to send DISC command ,as requester,there is no need to send the DISC control frame,it will cause redundant data.
--- drivers/tty/n_gsm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/tty/n_gsm.c +8 -3
@@ -2050,7 +2050,8 @@ static int gsm_disconnect(struct gsm_mux *gsm)del_timer_sync (&gsm->t2_timer);/* Now we are sure T2 has stopped */ -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci);wait_event_interruptible (gsm->event, dlci->state ==DLCI_CLOSED );
@@ -3014,6 +3015,7 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)static void gsmtty_close (struct tty_struct *tty,struct file *filp) {struct gsm_dlci *dlci = tty->driver_data; +struct gsm_mux *gsm = dlci->gsm;if (dlci ==NULL )return ;
@@ -3024,7 +3026,8 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)mutex_unlock (&dlci->mutex);if (tty_port_close_start (&dlci->port, tty, filp) ==0 )return ; -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci);if (tty_port_initialized (&dlci->port) &&C_HUPCL (tty))tty_port_lower_dtr_rts (&dlci->port);tty_port_close_end (&dlci->port, tty);
@@ -3035,10 +3038,12 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)static void gsmtty_hangup (struct tty_struct *tty) {struct gsm_dlci *dlci = tty->driver_data; +struct gsm_mux *gsm = dlci->gsm;if (dlci->state ==DLCI_CLOSED )return ;tty_port_hangup (&dlci->port); -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci); } static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,
Signature · 1 line
1.9.1
Greg KH
maintainerQuoted 59 lines · Zhenguo Zhao
From: Zhenguo Zhao <[email protected]>
as initiator,it need to send DISC command ,as requester,there is no need to send the DISC control frame,it will cause redundant data.
Signed-off-by Zhenguo Zhao <[email protected]>--- drivers/tty/n_gsm.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)drivers/tty/n_gsm.c +8
-3@@ -2050,7 +2050,8 @@ static int gsm_disconnect(struct gsm_mux *gsm)del_timer_sync (&gsm->t2_timer);/* Now we are sure T2 has stopped */ -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci);wait_event_interruptible (gsm->event, dlci->state ==DLCI_CLOSED );@@ -3014,6 +3015,7 @@ static int gsmtty_open(struct tty_struct *tty, struct file *filp)static void gsmtty_close (struct tty_struct *tty,struct file *filp) {struct gsm_dlci *dlci = tty->driver_data; +struct gsm_mux *gsm = dlci->gsm;if (dlci ==NULL )return ;@@ -3024,7 +3026,8 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)mutex_unlock (&dlci->mutex);if (tty_port_close_start (&dlci->port, tty, filp) ==0 )return ; -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci);if (tty_port_initialized (&dlci->port) &&C_HUPCL (tty))tty_port_lower_dtr_rts (&dlci->port);tty_port_close_end (&dlci->port, tty);@@ -3035,10 +3038,12 @@ static void gsmtty_close(struct tty_struct *tty, struct file *filp)static void gsmtty_hangup (struct tty_struct *tty) {struct gsm_dlci *dlci = tty->driver_data; +struct gsm_mux *gsm = dlci->gsm;if (dlci->state ==DLCI_CLOSED )return ;tty_port_hangup (&dlci->port); -gsm_dlci_begin_close (dlci); +if (gsm->initiator) +gsm_dlci_begin_close (dlci); } static int gsmtty_write(struct tty_struct *tty, const unsigned char *buf,Signature · 1 line
1.9.1
Hi,
This is the friendly patch-bot of Greg Kroah-Hartman. You have sent him a patch that has triggered this response. He used to manually respond to these common problems, but in order to save his sanity (he kept writing the same thing over and over, yet to different people), I was created. Hopefully you will not take offence and will fix the problem in your patch and resubmit it so that it can be accepted into the Linux kernel tree.
You are receiving this message because of the following common error(s) as indicated below:
- This looks like a new version of a previously submitted patch, but you did not list below the --- line any changes from the previous version. Please read the section entitled "The canonical patch format" in the kernel file, Documentation/SubmittingPatches for what needs to be done here to properly describe this.
If you wish to discuss this problem further, or you have questions about how to resolve this issue, please feel free to respond to this email and Greg will reply once he has dug out from the pending patches received from other developers.
thanks,
greg k-h's patch email bot
Dan Carpenter
build botCC: kbuild-all(a)lists.01.org In-Reply-To: <[email protected]> References: <[email protected]> TO: Zhenguo Zhao…
CC: kbuild-all(a)lists.01.org
In-Reply-To: <[email protected]>
References: <[email protected]>
TO: Zhenguo Zhao <[email protected]>
TO: zhenguo6858(a)gmail.com
TO: gregkh(a)linuxfoundation.org
TO: jirislaby(a)kernel.org
CC: linux-kernel(a)vger.kernel.org
Hi Zhenguo,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on tty/tty-testing]
[also build test WARNING on v5.13 next-20210701]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Zhenguo-Zhao/tty-n_gsm-delete-DISC-command-frame-as-requester/20210705-102943 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty.git tty-testing
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours ago
config: openrisc-randconfig-m031-20210705 (attached as .config)
compiler: or1k-linux-gcc (GCC) 9.3.0
If you fix the issue, kindly add following tag as appropriate
smatch warnings:drivers/tty/n_gsm.c:3023 gsmtty_close() warn: variable dereferenced before check 'dlci' (see line 3021)
vim +/dlci +3023 drivers/tty/n_gsm.c
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3017
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3018 static void gsmtty_close(struct tty_struct *tty, struct file *filp)
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3019 {
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3020 struct gsm_dlci *dlci = tty->driver_data;
f72c4013b314ba drivers/tty/n_gsm.c Zhenguo Zhao 2021-07-05 @3021 struct gsm_mux *gsm = dlci->gsm;
6ab8fba7fcb012 drivers/tty/n_gsm.c Russ Gorby 2011-06-16 3022
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 @3023 if (dlci == NULL)
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3024 return;
4d9b109060f690 drivers/tty/n_gsm.c Dirkjan Bussink 2013-01-30 3025 if (dlci->state == DLCI_CLOSED)
4d9b109060f690 drivers/tty/n_gsm.c Dirkjan Bussink 2013-01-30 3026 return;
bcd5abe28f40cc drivers/tty/n_gsm.c Russ Gorby 2011-06-16 3027 mutex_lock(&dlci->mutex);
bcd5abe28f40cc drivers/tty/n_gsm.c Russ Gorby 2011-06-16 3028 gsm_destroy_network(dlci);
bcd5abe28f40cc drivers/tty/n_gsm.c Russ Gorby 2011-06-16 3029 mutex_unlock(&dlci->mutex);
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3030 if (tty_port_close_start(&dlci->port, tty, filp) == 0)
dfabf7ffa30585 drivers/tty/n_gsm.c Chao Bi 2013-11-26 3031 return;
f72c4013b314ba drivers/tty/n_gsm.c Zhenguo Zhao 2021-07-05 3032 if (gsm->initiator)
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3033 gsm_dlci_begin_close(dlci);
d41861ca19c9e9 drivers/tty/n_gsm.c Peter Hurley 2016-04-09 3034 if (tty_port_initialized(&dlci->port) && C_HUPCL(tty))
957dacaee56d18 drivers/tty/n_gsm.c Johan Hovold 2013-03-07 3035 tty_port_lower_dtr_rts(&dlci->port);
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3036 tty_port_close_end(&dlci->port, tty);
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3037 tty_port_tty_set(&dlci->port, NULL);
dfabf7ffa30585 drivers/tty/n_gsm.c Chao Bi 2013-11-26 3038 return;
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3039 }
e1eaea46bb4020 drivers/char/n_gsm.c Alan Cox 2010-03-26 3040 ---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org