All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/3] pcmcia:  Handle request_irq() failure while opening device
@ 2007-02-26 16:09 Monakhov Dmitriy
  2007-02-26 18:07 ` Dmitriy Monakhov
  0 siblings, 1 reply; 2+ messages in thread
From: Monakhov Dmitriy @ 2007-02-26 16:09 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-pcmcia, devel



Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
---
 drivers/net/pcmcia/axnet_cs.c |    8 +++++++-
 drivers/net/pcmcia/pcnet_cs.c |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 6139048..9b57bab 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -523,6 +523,7 @@ static int axnet_open(struct net_device *dev)
 {
     axnet_dev_t *info = PRIV(dev);
     struct pcmcia_device *link = info->p_dev;
+    int err = 0;
     
     DEBUG(2, "axnet_open('%s')\n", dev->name);
 
@@ -531,7 +532,12 @@ static int axnet_open(struct net_device *dev)
 
     link->open++;
 
-    request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
+    err = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
+    if (err) {
+		printk("axnet_cs: request_irq() failed  %s\n", dev->name);
+		link->open--;
+		return -EBUSY;
+    }
 
     info->link_status = 0x00;
     init_timer(&info->watchdog);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d88e9b2..13923ea 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -962,6 +962,7 @@ static int pcnet_open(struct net_device *dev)
 {
     pcnet_dev_t *info = PRIV(dev);
     struct pcmcia_device *link = info->p_dev;
+    int err = 0;
 
     DEBUG(2, "pcnet_open('%s')\n", dev->name);
 
@@ -971,7 +972,12 @@ static int pcnet_open(struct net_device *dev)
     link->open++;
 
     set_misc_reg(dev);
-    request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
+    err = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
+    if (err) {
+		printk("pcnet_open: request_irq() failed  %s\n", dev->name);
+		link->open--;
+		return -EBUSY;
+    }
 
     info->phy_id = info->eth_phy;
     info->link_status = 0x00;
-- 
1.5.0.1



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

* Re: [PATCH 2/3] pcmcia:  Handle request_irq() failure while opening device
  2007-02-26 16:09 [PATCH 2/3] pcmcia: Handle request_irq() failure while opening device Monakhov Dmitriy
@ 2007-02-26 18:07 ` Dmitriy Monakhov
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-02-26 18:07 UTC (permalink / raw)
  To: Monakhov Dmitriy; +Cc: linux-kernel, linux-pcmcia, devel

Monakhov Dmitriy <dmonakhov@openvz.org> writes:

> Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
> ---
>  drivers/net/pcmcia/axnet_cs.c |    8 +++++++-
>  drivers/net/pcmcia/pcnet_cs.c |    8 +++++++-
>  2 files changed, 14 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
> index 6139048..9b57bab 100644
> --- a/drivers/net/pcmcia/axnet_cs.c
> +++ b/drivers/net/pcmcia/axnet_cs.c
> @@ -523,6 +523,7 @@ static int axnet_open(struct net_device *dev)
>  {
>      axnet_dev_t *info = PRIV(dev);
>      struct pcmcia_device *link = info->p_dev;
> +    int err = 0;
>      
>      DEBUG(2, "axnet_open('%s')\n", dev->name);
>  
> @@ -531,7 +532,12 @@ static int axnet_open(struct net_device *dev)
>  
>      link->open++;
>  
> -    request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
> +    err = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
> +    if (err) {
> +		printk("axnet_cs: request_irq() failed  %s\n", dev->name);
> +		link->open--;
> +		return -EBUSY;
As David Miller noted it is better to return exact error code from request_irq(),
truly most net_device->open() functions return error code without changing.  
The updated patch version following:

Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
---
 drivers/net/pcmcia/axnet_cs.c |    8 +++++++-
 drivers/net/pcmcia/pcnet_cs.c |    8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index 6139048..9b57bab 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -523,6 +523,7 @@ static int axnet_open(struct net_device *dev)
 {
     axnet_dev_t *info = PRIV(dev);
     struct pcmcia_device *link = info->p_dev;
+    int err = 0;
     
     DEBUG(2, "axnet_open('%s')\n", dev->name);
 
@@ -531,7 +532,12 @@ static int axnet_open(struct net_device *dev)
 
     link->open++;
 
-    request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
+    err = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
+    if (err) {
+		printk("axnet_cs: request_irq() failed  %s\n", dev->name);
+		link->open--;
+		return err;
+    }
 
     info->link_status = 0x00;
     init_timer(&info->watchdog);
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index d88e9b2..13923ea 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -962,6 +962,7 @@ static int pcnet_open(struct net_device *dev)
 {
     pcnet_dev_t *info = PRIV(dev);
     struct pcmcia_device *link = info->p_dev;
+    int err = 0;
 
     DEBUG(2, "pcnet_open('%s')\n", dev->name);
 
@@ -971,7 +972,12 @@ static int pcnet_open(struct net_device *dev)
     link->open++;
 
     set_misc_reg(dev);
-    request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
+    err = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
+    if (err) {
+		printk("pcnet_open: request_irq() failed  %s\n", dev->name);
+		link->open--;
+		return err;
+    }
 
     info->phy_id = info->eth_phy;
     info->link_status = 0x00;
-- 
1.5.0.1


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

end of thread, other threads:[~2007-02-26 18:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-26 16:09 [PATCH 2/3] pcmcia: Handle request_irq() failure while opening device Monakhov Dmitriy
2007-02-26 18:07 ` Dmitriy Monakhov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.