Messages in this thread | | | Date | Wed, 10 May 2006 17:27:08 +0100 | From | Russell King <> | Subject | Re: [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/
| |