On Thu, 2016-11-10 at 14:59 +0100, Greg Kroah-Hartman wrote: > On Thu, Nov 03, 2016 at 06:26:57PM +0200, Andy Shevchenko wrote: > > Static analyzer can not see balanced locking if the lock is acquired > > and > > released conditionally. Add __acquire() and __release() markings in > > the right > > locations so that sparse isn't tripped up on the conditional > > locking. > > > > drivers/tty/serial/serial_core.c:131:17: warning: context imbalance > > in 'uart_stop' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_start' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_put_char' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_write' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_write_room' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_chars_in_buffer' - unexpected unlock > > include/linux/spinlock.h:362:9: warning: context imbalance in > > 'uart_flush_buffer' - unexpected unlock > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> > > --- > > drivers/tty/serial/serial_core.c | 4 ++++ > > 1 file changed, 4 insertions(+) > > > > diff --git a/drivers/tty/serial/serial_core.c > > b/drivers/tty/serial/serial_core.c > > index f2303f3..ff90c8e 100644 > > --- a/drivers/tty/serial/serial_core.c > > +++ b/drivers/tty/serial/serial_core.c > > @@ -82,6 +82,8 @@ static inline void uart_port_deref(struct > > uart_port *uport) > > struct uart_port *__uport = uart_port_ref(state); > > \ > > if (__uport) > > \ > > spin_lock_irqsave(&__uport->lock, flags); > > \ > > + else > > \ > > + __acquire(&__uport->lock); > > \ > > That doesn't make much logical sense. Yes, I know __acquire is just a > crazy macro, but really, look at what you just wrote and tell me that > someone who doesn't know what __acquire does, would instantly think > this > is a null pointer dereference. > > Please fix. Do you mean add comments here in the code? -- Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx> Intel Finland Oy -- To unsubscribe from this list: send the line "unsubscribe linux-serial" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html