cvs commit: src/sys/kern subr_bus.c

Nate Lawson nate at root.org
Sat Jan 14 12:47:12 PST 2006


Poul-Henning Kamp wrote:
> phk         2006-01-14 09:41:35 UTC
> 
>   FreeBSD src repository
> 
>   Modified files:
>     sys/kern             subr_bus.c 
>   Log:
>   Correct STAILQ usage in purge of resourcelist.
>   
>   Found with:   Coverity Prevent(tm)
>   
>   Revision  Changes    Path
>   1.188     +1 -1      src/sys/kern/subr_bus.c
> 
> 
> Index: src/sys/kern/subr_bus.c
> diff -u src/sys/kern/subr_bus.c:1.187 src/sys/kern/subr_bus.c:1.188
> --- src/sys/kern/subr_bus.c:1.187	Tue Oct  4 22:25:14 2005
> +++ src/sys/kern/subr_bus.c	Sat Jan 14 09:41:35 2006
> @@ -2820,7 +2820,7 @@
>  {
>  	struct resource_list_entry *rle;
>  
> -	STAILQ_FOREACH(rle, rl, link) {
> +	while ((rle = STAILQ_FIRST(rl)) != NULL) {
>  		if (rle->res)
>  			bus_release_resource(rman_get_device(rle->res),
>  			    rle->type, rle->rid, rle->res);

Isn't that what the STAILQ_FOREACH_SAFE() macro is for?  List traversal 
with deletion?  Your approach is also fine.

-- 
Nate


More information about the cvs-src mailing list