Linux Serial subsystem development
 help / color / mirror / Atom feed
From: "Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>
To: "Nuno Gonçalves" <nunojpg@gmail.com>
Cc: linux-serial <linux-serial@vger.kernel.org>
Subject: [RFC PATCH] serial: Don't assume uart_ops .throttle is always set
Date: Thu, 28 Apr 2022 20:11:56 +0300 (EEST)	[thread overview]
Message-ID: <62859dbd-7ced-34f-55c-ce1b5f6625d@linux.intel.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 930 bytes --]

uart_throttle() assumes that a driver provides a throttle function in
uart_ops. But not all drivers do and there seems to nothing in
serial_core that would set it either. Thus, check it before calling.

Reported-by: Nuno Gonçalves <nunojpg@gmail.com>
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>

---
 drivers/tty/serial/serial_core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/tty/serial/serial_core.c b/drivers/tty/serial/serial_core.c
index 6a8963caf954..18c9d46e0b85 100644
--- a/drivers/tty/serial/serial_core.c
+++ b/drivers/tty/serial/serial_core.c
@@ -697,7 +697,8 @@ static void uart_throttle(struct tty_struct *tty)
 		mask |= UPSTAT_AUTORTS;
 
 	if (port->status & mask) {
-		port->ops->throttle(port);
+		if (port->ops->throttle)
+			port->ops->throttle(port);
 		mask &= ~port->status;
 	}
 

-- 
tg: (19317433057d..) serial/fix-uart_throttle (depends on: tty-linus)

             reply	other threads:[~2022-04-28 17:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 17:11 Ilpo Järvinen [this message]
2022-04-28 18:37 ` [RFC PATCH] serial: Don't assume uart_ops .throttle is always set Greg KH
2022-04-29  5:21 ` Tomasz Mon
2022-04-29  7:19   ` Ilpo Järvinen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=62859dbd-7ced-34f-55c-ce1b5f6625d@linux.intel.com \
    --to=ilpo.jarvinen@linux.intel.com \
    --cc=linux-serial@vger.kernel.org \
    --cc=nunojpg@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox