public inbox for linux-serial@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] jsm: removing the uart structure and filename on error
@ 2010-02-02  1:34 leitao
  2010-02-02  1:34 ` [PATCH 2/2] jsm: fixing error if the driver fails to load leitao
  2010-02-23 20:27 ` [PATCH 1/2] jsm: removing the uart structure and filename on error Breno Leitao
  0 siblings, 2 replies; 4+ messages in thread
From: leitao @ 2010-02-02  1:34 UTC (permalink / raw)
  To: linux-serial, scottk; +Cc: Breno Leitao

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>
---
 drivers/serial/jsm/jsm_driver.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/serial/jsm/jsm_driver.c b/drivers/serial/jsm/jsm_driver.c
index 108c3e0..12cb5e4 100644
--- a/drivers/serial/jsm/jsm_driver.c
+++ b/drivers/serial/jsm/jsm_driver.c
@@ -179,6 +179,7 @@ static int __devinit jsm_probe_one(struct pci_dev *pdev, const struct pci_device
 
 	return 0;
  out_free_irq:
+	jsm_remove_uart_port(brd);
 	free_irq(brd->irq, brd);
  out_iounmap:
 	iounmap(brd->re_map_membase);
-- 
1.6.0.2


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

* [PATCH 2/2] jsm: fixing error if the driver fails to load
  2010-02-02  1:34 [PATCH 1/2] jsm: removing the uart structure and filename on error leitao
@ 2010-02-02  1:34 ` leitao
  2010-02-23 20:27 ` [PATCH 1/2] jsm: removing the uart structure and filename on error Breno Leitao
  1 sibling, 0 replies; 4+ messages in thread
From: leitao @ 2010-02-02  1:34 UTC (permalink / raw)
  To: linux-serial, scottk; +Cc: Breno Leitao

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>
---
 drivers/serial/jsm/jsm_tty.c |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c
index cd95e21..5673ca9 100644
--- 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_board *brd)
 
 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 *brd)
 		} 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);
 	}
-- 
1.6.0.2


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

* Re: [PATCH 1/2] jsm: removing the uart structure and filename on error
  2010-02-02  1:34 [PATCH 1/2] jsm: removing the uart structure and filename on error leitao
  2010-02-02  1:34 ` [PATCH 2/2] jsm: fixing error if the driver fails to load leitao
@ 2010-02-23 20:27 ` Breno Leitao
  2010-02-23 20:56   ` Greg KH
  1 sibling, 1 reply; 4+ messages in thread
From: Breno Leitao @ 2010-02-23 20:27 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-serial, scottk

Greg, 

I sent this patch almost a month ago, and I didn't hear from Scott.
What are the next steps here now ? Could you apply it directly since
this is a pretty trivial patch ?

Thanks, 
Breno

leitao@linux.vnet.ibm.com wrote:
> 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:
> 


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

* Re: [PATCH 1/2] jsm: removing the uart structure and filename on error
  2010-02-23 20:27 ` [PATCH 1/2] jsm: removing the uart structure and filename on error Breno Leitao
@ 2010-02-23 20:56   ` Greg KH
  0 siblings, 0 replies; 4+ messages in thread
From: Greg KH @ 2010-02-23 20:56 UTC (permalink / raw)
  To: Breno Leitao; +Cc: linux-serial, scottk

On Tue, Feb 23, 2010 at 05:27:36PM -0300, Breno Leitao wrote:
> Greg, 
> 
> I sent this patch almost a month ago, and I didn't hear from Scott.
> What are the next steps here now ? Could you apply it directly since
> this is a pretty trivial patch ?

Sure, but what patch?

I don't see one here, can you resend it to me?

thanks,

greg k-h

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

end of thread, other threads:[~2010-02-23 20:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02  1:34 [PATCH 1/2] jsm: removing the uart structure and filename on error leitao
2010-02-02  1:34 ` [PATCH 2/2] jsm: fixing error if the driver fails to load leitao
2010-02-23 20:27 ` [PATCH 1/2] jsm: removing the uart structure and filename on error Breno Leitao
2010-02-23 20:56   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox