[coreboot] [PATCH] [v3] add unwanted_vpci parsing to cs5536 southbridge

Ward Vandewege ward at gnu.org
Thu Apr 10 04:03:12 CEST 2008


On Thu, Apr 10, 2008 at 03:44:35AM +0200, Carl-Daniel Hailfinger wrote:
> On 10.04.2008 03:06, Ward Vandewege wrote:
> > This one is largely thanks to Marc. Mostly written during the summit in
> > Denver. It depends on the dts patch I just sent.

All errors are my own of course!

> > +	/* disable unwanted virtual PCI devices */
> > +	int i;
> >   
> 
> Maybe move the int i; declaration inside the for statement? That makes
> the scope more obvious and has the added benefit of possibly conserving
> stack space (if other loops do the same). Yes, I know this is C99 only,
> but we have other uses for C99 which enables some cleanups.

That doesn't work:

  southbridge/amd/cs5536/cs5536.c:652: error: ‘for’ loop initial declaration
used outside C99 mode

Suggestions?

> > +	for (i = 0; 0 != (char *)(sb->unwanted_vpci[i]); i = i+4) {
> >   
> 
> Ugh. What exactly are you trying to do? This looks wrong on so many
> levels. Wouldn't the following line be more correct?
> 
> for (int i = 0; sb->unwanted_vpci[i]; i++) {

You're right of course, much better that way (minus the int declaration). My
line just happened to match the first entry but was plain wrong...

Thanks,
Ward.

-- 
Ward Vandewege <ward at fsf.org>
Free Software Foundation - Senior System Administrator




More information about the coreboot mailing list