lkml.org 
[lkml]   [2007]   [Feb]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] SUN3/3X Lance trivial fix
Cyrill V. Gorcunov napsal(a):
> This patch adds checking for allocated DVMA
> memory and granted IRQ line.
>
> Signed-off-by: Cyrill V. Gorcunov <gorcunov@gmail.com>
>
> ---
>
> drivers/net/sun3lance.c | 9 ++++++++-
> 1 files changed, 8 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c
> index c62e85d..e4c2c88 100644
> --- a/drivers/net/sun3lance.c
> +++ b/drivers/net/sun3lance.c
> @@ -336,13 +336,20 @@ static int __init lance_probe( struct net_device *dev)
>
> /* XXX - leak? */
> MEM = dvma_malloc_align(sizeof(struct lance_memory), 0x10000);
> + if (MEM == NULL) {
> + printk(KERN_WARNING "SUN3 Lance couldn't allocate DVMA memory\n");
> + return 0;
> + }
>
> lp->iobase = (volatile unsigned short *)ioaddr;
> dev->base_addr = (unsigned long)ioaddr; /* informational only */

But now, if it fails (and you return 0=OK state) these are not assigned and
probably used later.

>
> REGA(CSR0) = CSR0_STOP;
>
> - request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev);
> + if (request_irq(LANCE_IRQ, lance_interrupt, IRQF_DISABLED, "SUN3 Lance", dev) < 0) {
> + printk(KERN_WARNING "SUN3 Lance unable to allocate IRQ\n");
> + return 0;
> + }
> dev->irq = (unsigned short)LANCE_IRQ;

Not even irq is grabbed.

Is this intended?

regards,
--
http://www.fi.muni.cz/~xslaby/ Jiri Slaby
faculty of informatics, masaryk university, brno, cz
e-mail: jirislaby gmail com, gpg pubkey fingerprint:
B674 9967 0407 CE62 ACC8 22A0 32CC 55C3 39D4 7A7E
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-02-06 12:39    [W:0.038 / U:1.540 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site