lkml.org 
[lkml]   [2006]   [May]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] MPSC serial driver tx locking
On Tue, May 09, 2006 at 05:35:52PM -0700, Dave Jiang wrote:
> @@ -1997,7 +2018,7 @@ mpsc_drv_probe(struct platform_device *d
> if (!(rc = mpsc_make_ready(pi)))
> if (!(rc = uart_add_one_port(&mpsc_reg,
> &pi->port)))
> - rc = 0;
> + spin_lock_init(&pi->tx_lock);

You publish the port to the uart layer and then do initialisation.
What if someone nips in and starts using the port between registering
it and initialising the spinlock? (that's a general principle - for
any device driver, never publish the device interfaces until you've
completed all initialisation.)

Why not do the spinlock initialisation first?

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-05-10 18:29    [W:0.068 / U:0.268 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site