aboutsummaryrefslogtreecommitdiffstats
path: root/tty
diff options
authorGreg Kroah-Hartman <gregkh@suse.de>2010-02-26 16:48:46 -0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-02-26 16:48:46 -0800
commit6d6bd90e42824035a3346dd1835026e55cd5201b (patch)
treee60264ad74db5e67feeff69e758d32f6c935158c /tty
parent639129d7091fea3473ace7d14eaf10aec218d89b (diff)
downloadpatches-6d6bd90e42824035a3346dd1835026e55cd5201b.tar.gz
more patch fun.
Diffstat (limited to 'tty')
-rw-r--r--tty/jsm-fixing-error-if-the-driver-fails-to-load.patch55
-rw-r--r--tty/jsm-removing-the-uart-structure-and-filename-on-error.patch35
2 files changed, 90 insertions, 0 deletions
diff --git a/tty/jsm-fixing-error-if-the-driver-fails-to-load.patch b/tty/jsm-fixing-error-if-the-driver-fails-to-load.patch
new file mode 100644
index 00000000000000..ef0fcd1f0b5bf0
--- /dev/null
+++ b/tty/jsm-fixing-error-if-the-driver-fails-to-load.patch
@@ -0,0 +1,55 @@
+From leitao@linux.vnet.ibm.com Fri Feb 26 16:30:33 2010
+From: Breno Leitao <leitao@linux.vnet.ibm.com>
+Date: Thu, 25 Feb 2010 15:31:50 -0300
+Subject: jsm: fixing error if the driver fails to load
+To: greg@kroah.com
+Message-ID: <838541aafe98426bcaf57ee2b645437858f19cf4.1267122632.git.leitao@linux.vnet.ibm.com>
+
+
+Currently if the driver fails to register on port, the kernel
+crashes with the following stack:
+
+cpu 0x1: Vector: 300 (Data Access) at [c0000000e0303090]
+ pc: c00000000039aa74: .__mutex_lock_slowpath+0x44/0x10c
+ lr: c00000000039aa58: .__mutex_lock_slowpath+0x28/0x10c
+[c0000000e03033c0] c00000000026b074 .uart_remove_one_port+0xbc/0x16c
+[c0000000e0303460] d0000000000e0554 .jsm_remove_uart_port+0x8c/0x10c [jsm]
+[c0000000e03034f0] d0000000000dc034 .jsm_remove_one+0x34/0x108 [jsm]
+[c0000000e0303590] c0000000001f4aa0 .pci_device_remove+0x48/0x74
+...
+
+This patch just fixes the code flow to abort the load when an
+error is detected.
+
+Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/jsm/jsm_tty.c | 9 ++++++---
+ 1 file changed, 6 insertions(+), 3 deletions(-)
+
+--- a/drivers/serial/jsm/jsm_tty.c
++++ b/drivers/serial/jsm/jsm_tty.c
+@@ -432,7 +432,7 @@ int __devinit jsm_tty_init(struct jsm_bo
+
+ int jsm_uart_port_init(struct jsm_board *brd)
+ {
+- int i;
++ int i, rc;
+ unsigned int line;
+ struct jsm_channel *ch;
+
+@@ -467,8 +467,11 @@ int jsm_uart_port_init(struct jsm_board
+ } else
+ set_bit(line, linemap);
+ brd->channels[i]->uart_port.line = line;
+- if (uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port))
+- printk(KERN_INFO "jsm: add device failed\n");
++ rc = uart_add_one_port (&jsm_uart_driver, &brd->channels[i]->uart_port);
++ if (rc){
++ printk(KERN_INFO "jsm: Port %d failed. Aborting...\n", i);
++ return rc;
++ }
+ else
+ printk(KERN_INFO "jsm: Port %d added\n", i);
+ }
diff --git a/tty/jsm-removing-the-uart-structure-and-filename-on-error.patch b/tty/jsm-removing-the-uart-structure-and-filename-on-error.patch
new file mode 100644
index 00000000000000..520705a622a3c9
--- /dev/null
+++ b/tty/jsm-removing-the-uart-structure-and-filename-on-error.patch
@@ -0,0 +1,35 @@
+From leitao@linux.vnet.ibm.com Fri Feb 26 16:30:15 2010
+From: Breno Leitao <leitao@linux.vnet.ibm.com>
+Date: Thu, 25 Feb 2010 15:31:49 -0300
+Subject: jsm: removing the uart structure and filename on error
+To: greg@kroah.com
+Message-ID: <daf3e60a90070795196e941ac058335ead36ce14.1267122632.git.leitao@linux.vnet.ibm.com>
+
+
+If jsm fails to load, then remove the uart stuff, otherwise,
+the things (as files), will be there forever (even when the module
+is unloaded). If you try to reload the module, the following message
+appears:
+
+kobject_add_internal failed for ttyn1 with -EEXIST, don't try to
+register things with the same name in the same directory.
+
+This patch remove the uart things when the driver fails.
+
+Signed-off-by: Breno Leitao <leitao@linux.vnet.ibm.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+
+---
+ drivers/serial/jsm/jsm_driver.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/serial/jsm/jsm_driver.c
++++ b/drivers/serial/jsm/jsm_driver.c
+@@ -179,6 +179,7 @@ static int __devinit jsm_probe_one(struc
+
+ return 0;
+ out_free_irq:
++ jsm_remove_uart_port(brd);
+ free_irq(brd->irq, brd);
+ out_iounmap:
+ iounmap(brd->re_map_membase);