From: Miguel Ojeda on 10 May 2010 09:30 On Sat, May 8, 2010 at 11:58 PM, Miguel Ojeda <miguel.ojeda.sandonis(a)gmail.com> wrote: > Hi, > > I found two problems using the Simics' sunfire target, so maybe the > following does not occur in real machines. > > 1. At grlib_apbuart_configure() in apbuart.c, prop can be NULL if > "clock-frequency" doesn't exist in the OF tree: > > � � � �/* Get bus frequency */ > � � � �rp = of_find_node_by_path("/"); > � � � �rp = of_get_next_child(rp, NULL); > � � � �prop = of_get_property(rp, "clock-frequency", NULL); > � � � �freq_khz = *prop; > > 2. In addition, apbuart.c does not check if there aren't any ports > configured after calls to grlib_apbuart_configure(), so other oops will > occur if no port was configured (e.g. uart_set_options() because of > port->ops). > > In order to solve that, I added a check after both of the calls to > grlib_apbuart_configure(). > > The patch that I provide below prevents both problems in the Simics' > sunfire target. > > Tested against 2.6.33.3. Please review. > > Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis(a)gmail.com> > --- > --- drivers/serial/apbuart.c.orig � � � 2010-04-26 16:48:30.000000000 +0200 > +++ drivers/serial/apbuart.c � �2010-05-08 23:50:36.786148571 +0200 > @@ -525,6 +525,9 @@ static void grlib_apbuart_configure(void > �static int __init apbuart_console_init(void) > �{ > � � � �grlib_apbuart_configure(); > + � � � if (grlib_apbuart_port_nr == 0) > + � � � � � � � return 0; > + > � � � �register_console(&grlib_apbuart_console); > � � � �return 0; > �} > @@ -612,6 +615,8 @@ static void grlib_apbuart_configure(void > � � � �rp = of_find_node_by_path("/"); > � � � �rp = of_get_next_child(rp, NULL); > � � � �prop = of_get_property(rp, "clock-frequency", NULL); > + � � � if (prop == NULL) grlib_apbuart_port_nr = 0; should be added here or in apbuart.h better. > + � � � � � � � return; > � � � �freq_khz = *prop; > > � � � �line = 0; > @@ -666,6 +671,11 @@ static int __init grlib_apbuart_init(voi > > � � � �/* Find all APBUARTS in device the tree and initialize their ports */ > � � � �grlib_apbuart_configure(); > + � � � if (grlib_apbuart_port_nr == 0) { > + � � � � � � � printk(KERN_INFO "Serial: GRLIB APBUART: No ports found.\n", > + � � � � � � � � � � � __FILE__); > + � � � � � � � return 0; > + � � � } > > � � � �printk(KERN_INFO "Serial: GRLIB APBUART driver\n"); > > > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo(a)vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
|
Pages: 1 Prev: Handle instruction cache maintenance fault properly Next: Power Domain Framework |