lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <154e089b0902151157s6e185815jd86428518b58af6@mail.gmail.com>
Date:	Sun, 15 Feb 2009 20:57:59 +0100
From:	Hannes Eder <hannes@...neseder.net>
To:	wharms@....de
Cc:	netdev@...r.kernel.org, kernel-janitors@...r.kernel.org,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH 02/43] drivers/net/e2100.c: fix sparse warning: symbol 
	shadows an earlier one

On Sun, Feb 15, 2009 at 3:04 PM, walter harms <wharms@....de> wrote:
> Hi Hannes,
> it is ok to replace a fixed boarder with ARRAY_SIZE()
> in this special case i would success the following additional cleanup
> (untestet !!)
>
>
> static int set_free_irq(struct net_device *dev)
> {
>  int irqlist[] = {15,11,10,12,5,9,3,4}, i;
>
>        for (i = 0; i < ARRAY_SIZE(irqlist); i++)
>           if (request_irq (irqlist[i], NULL, 0, "bogus", NULL) != -EBUSY) {
>                        dev->irq = irqlist[i];
>                        return 0;
>            }
>        return -1;
> }
>
> ....
>
> if (dev->irq < 2) {
>         if ( set_free_irq(dev) < 0) {
>                printk(" unable to get IRQ %d.\n", dev->irq);
>                retval = -EAGAIN;
>                goto out;
>        }
>
> for me this looks more readable.
>
> getting a free interrupt from a list mus be a common problem ? I am not in driver programming
> perhaps such a code is already in place somewhere  ?

I am a great fan of refactoring but in that case I would just leave it
as is.  If extracting a method I would extract a little more here.

Best,
Hannes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ