hammers[i++] = loop_dev; nr_garts = i; #ifdef CONFIG_SMP if (i == MAX_HAMMER_GARTS) { printk(KERN_INFO PFX "Too many northbridges for AGP\n"); return -1; }
Seems wrong to me... wouldn't this return -1 if say, MAX_HAMMER_GARTS == 1 and 1 gart was found ( nr_garts == i == 1 when the comparison is made ). It would need to be:
if (i > MAX_HAMMER_GARTS) { ...
This would also be wrong, as the test would be too late, and hammer[] would be overflowed by the time the test is performed. This is why the test was moved before the assignment in our patches. The way we did it would handle the SMP and non-smp cases I believe, the code you quoted would only work right in the uniproc case.
I can test this when I get home today though I suppose.
-James
#else
/* Uniprocessor case, return after finding first bridge.
(There may be more, but in UP, we don't care). */
return 0;
#endif
}
return i == 0 ? -1 : 0;
}
------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/ _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel