Linux-Serial Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/2] serial: add sparse context annotation
@ 2020-07-23 12:33 Johan Hovold
  2020-07-23 12:33 ` [PATCH v2 1/2] serial: pmac_zilog: " Johan Hovold
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Johan Hovold @ 2020-07-23 12:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-serial, linux-kernel, 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.

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(+)

-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 1/2] serial: pmac_zilog: add sparse context annotation
  2020-07-23 12:33 [PATCH v2 0/2] serial: add sparse context annotation Johan Hovold
@ 2020-07-23 12:33 ` Johan Hovold
  2020-07-23 12:33 ` [PATCH v2 2/2] serial: msm_serial: " Johan Hovold
  2020-07-23 13:22 ` [PATCH v2 0/2] serial: " andriy.shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-07-23 12:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Jiri Slaby, linux-serial, linux-kernel, Johan Hovold, kernel test robot

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

Reported-by: kernel test robot <lkp@intel.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/tty/serial/pmac_zilog.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/tty/serial/pmac_zilog.c b/drivers/tty/serial/pmac_zilog.c
index ba65a3bbd72a..96e7aa479961 100644
--- a/drivers/tty/serial/pmac_zilog.c
+++ b/drivers/tty/serial/pmac_zilog.c
@@ -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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2 2/2] serial: msm_serial: add sparse context annotation
  2020-07-23 12:33 [PATCH v2 0/2] serial: add sparse context annotation Johan Hovold
  2020-07-23 12:33 ` [PATCH v2 1/2] serial: pmac_zilog: " Johan Hovold
@ 2020-07-23 12:33 ` Johan Hovold
  2020-07-23 13:22 ` [PATCH v2 0/2] serial: " andriy.shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: Johan Hovold @ 2020-07-23 12:33 UTC (permalink / raw)
  To: Greg Kroah-Hartman; +Cc: Jiri Slaby, linux-serial, linux-kernel, 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

Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/tty/serial/msm_serial.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/tty/serial/msm_serial.c b/drivers/tty/serial/msm_serial.c
index 60a9c53fa7cb..87f005e5d2af 100644
--- a/drivers/tty/serial/msm_serial.c
+++ b/drivers/tty/serial/msm_serial.c
@@ -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;
-- 
2.26.2


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2 0/2] serial: add sparse context annotation
  2020-07-23 12:33 [PATCH v2 0/2] serial: add sparse context annotation Johan Hovold
  2020-07-23 12:33 ` [PATCH v2 1/2] serial: pmac_zilog: " Johan Hovold
  2020-07-23 12:33 ` [PATCH v2 2/2] serial: msm_serial: " Johan Hovold
@ 2020-07-23 13:22 ` andriy.shevchenko
  2 siblings, 0 replies; 4+ messages in thread
From: andriy.shevchenko @ 2020-07-23 13:22 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Greg Kroah-Hartman, Jiri Slaby, linux-serial, linux-kernel

On Thu, Jul 23, 2020 at 02:33:25PM +0200, Johan Hovold wrote:
> 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.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

> 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(+)
> 
> -- 
> 2.26.2
> 

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, back to index

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-23 12:33 [PATCH v2 0/2] serial: add sparse context annotation Johan Hovold
2020-07-23 12:33 ` [PATCH v2 1/2] serial: pmac_zilog: " Johan Hovold
2020-07-23 12:33 ` [PATCH v2 2/2] serial: msm_serial: " Johan Hovold
2020-07-23 13:22 ` [PATCH v2 0/2] serial: " andriy.shevchenko

Linux-Serial Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-serial/0 linux-serial/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-serial linux-serial/ https://lore.kernel.org/linux-serial \
		linux-serial@vger.kernel.org
	public-inbox-index linux-serial

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-serial


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git