Skip to contentSkip to conversation

serial: add sparse context annotation

PATCH In review Johan Hovold 2 participants 4 messages Jul 23, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v2 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

Changes in v2:
- let's use the right context expression even if sparse doesn't seem to care (add the missing ampersand)

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 v2 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..96e7aa479961 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 v2 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..87f005e5d2af 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
Reviewed-by on the v2 series
#3 lore raw
In reply to Johan Hovold
Quoted 5 lines · Johan Hovold

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.

Quoted 18 lines

Johan

Changes in v2:
- let's use the right context expression even if sparse doesn't seem to care (add the missing ampersand)

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
Signature · 2 lines
With Best Regards,
Andy Shevchenko