Skip to contentSkip to conversation

serial: add sparse context annotation

PATCH Superseded Johan Hovold 1 participant 3 messages Jul 23, 2020

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover serial: add sparse context annotation

The Intel test robot reported a new sparse warning in pmac_zilog, which wasn't actually new.

Add sparse annotation to the two drivers that release and reacquire the port lock in their receive handlers to suppress these warnings.

Johan

Johan Hovold (2):
serial: pmac_zilog: add sparse context annotation
serial: msm_serial: add sparse context annotation

 drivers/tty/serial/msm_serial.c | 2 ++
 drivers/tty/serial/pmac_zilog.c | 1 +
 2 files changed, 3 insertions(+)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/2 serial: pmac_zilog: add sparse context annotation

Add sparse context annotation to the receive handler, which releases and reacquires the port lock, to silence a sparse warning:

drivers/tty/serial/pmac_zilog.c:255:36: sparse: sparse: context imbalance in 'pmz_receive_chars' - unexpected unlock

---
 drivers/tty/serial/pmac_zilog.c | 1 +
 1 file changed, 1 insertion(+)
drivers/tty/serial/pmac_zilog.c +1 -0
index ba65a3bbd72a..b0d8f4a6f9b4 100644
@@ -213,6 +213,7 @@ static void pmz_interrupt_control(struct uart_pmac_port *uap, int enable)
 }
 
 static bool pmz_receive_chars(struct uart_pmac_port *uap)
+	__must_hold(uap->port.lock)
 {
 	struct tty_port *port;
 	unsigned char ch, r1, drop, flag;
Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/2 serial: msm_serial: add sparse context annotation

In reply to Johan Hovold

Add sparse context annotation to the receive handlers, which release and reacquire the port lock, to silence sparse warnings:

drivers/tty/serial/msm_serial.c:748:25: warning: context imbalance in 'msm_handle_rx_dm' - unexpected unlock drivers/tty/serial/msm_serial.c:814:28: warning: context imbalance in 'msm_handle_rx' - unexpected unlock

---
 drivers/tty/serial/msm_serial.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/tty/serial/msm_serial.c +2 -0
index 60a9c53fa7cb..7f26cda5ba1c 100644
@@ -696,6 +696,7 @@ static void msm_enable_ms(struct uart_port *port)
 }
 
 static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr)
+	__must_hold(port->lock)
 {
 	struct tty_port *tport = &port->state->port;
 	unsigned int sr;
@@ -771,6 +772,7 @@ static void msm_handle_rx_dm(struct uart_port *port, unsigned int misr)
 }
 
 static void msm_handle_rx(struct uart_port *port)
+	__must_hold(port->lock)
 {
 	struct tty_port *tport = &port->state->port;
 	unsigned int sr;
Signature · 1 line
2.26.2