linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* cpm_uart_port_map not initialised before serial console setup
@ 2006-07-13 14:55 Laurent Pinchart
  2006-07-13 17:05 ` Vitaly Bordug
  0 siblings, 1 reply; 2+ messages in thread
From: Laurent Pinchart @ 2006-07-13 14:55 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 593 bytes --]

Hi everybody,

while trying to use SCC1 as a serial console, I found a bug in the cpm_uart 
driver.

The cpm_uart_port_map table is initialised by cpm_uart_count() which is called 
in cpm_uart_init() at module_init() time. cpm_uart_console_setup(), called at 
console_initcall() time, accesses cpm_uart_port_map, leading to a crash when 
using any serial port except SMC1 as the serial console.

I attached a very simple patch to fix the problem, but it might be subject to 
race conditions. Could anyone familiar with the cpm_uart driver have a look 
at it ?

Best regards,

Laurent Pinchart

[-- Attachment #2: cpm_uart.patch --]
[-- Type: text/x-diff, Size: 403 bytes --]

diff --git a/drivers/serial/cpm_uart/cpm_uart_core.c b/drivers/serial/cpm_uart/cpm_uart_core.c
index a632897..a3c30f5 100644
--- a/drivers/serial/cpm_uart/cpm_uart_core.c
+++ b/drivers/serial/cpm_uart/cpm_uart_core.c
@@ -1240,6 +1240,7 @@ static struct console cpm_scc_uart_conso
 
 int __init cpm_uart_console_init(void)
 {
+	cpm_uart_count();
 	register_console(&cpm_scc_uart_console);
 	return 0;
 }

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

* Re: cpm_uart_port_map not initialised before serial console setup
  2006-07-13 14:55 cpm_uart_port_map not initialised before serial console setup Laurent Pinchart
@ 2006-07-13 17:05 ` Vitaly Bordug
  0 siblings, 0 replies; 2+ messages in thread
From: Vitaly Bordug @ 2006-07-13 17:05 UTC (permalink / raw)
  To: Laurent Pinchart; +Cc: linuxppc-embedded

On Thu, 13 Jul 2006 16:55:35 +0200
Laurent Pinchart <laurent.pinchart@tbox.biz> wrote:

> Hi everybody,
> 
> while trying to use SCC1 as a serial console, I found a bug in the cpm_uart 
> driver.
> 
> The cpm_uart_port_map table is initialised by cpm_uart_count() which is called 
> in cpm_uart_init() at module_init() time. cpm_uart_console_setup(), called at 
> console_initcall() time, accesses cpm_uart_port_map, leading to a crash when 
> using any serial port except SMC1 as the serial console.
> 
> I attached a very simple patch to fix the problem, but it might be subject to 
> race conditions. Could anyone familiar with the cpm_uart driver have a look 
> at it ?
> 
Ugh, you're right.

But I think we need to finally get rid of the stupid count/port_map creation based on #ifdefs.
I'll have a look at it immediately as time permits
 

-- 
Sincerely, 
Vitaly

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

end of thread, other threads:[~2006-07-13 17:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-07-13 14:55 cpm_uart_port_map not initialised before serial console setup Laurent Pinchart
2006-07-13 17:05 ` Vitaly Bordug

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).