From 46e3626adb86be2ff1321d26107cb75df07a7f4e Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Tue, 26 Aug 2014 23:38:44 +0800 Subject: xen/grant-table: refactor error cleanup in grow_gnttab_list() The cleanup loop in grow_gnttab_list() is safe from the underflow of the unsigned 'i' since nr_glist_frames is >= 1, but refactor it anyway. Signed-off-by: Chen Gang Signed-off-by: David Vrabel --- drivers/xen/grant-table.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/xen') diff --git a/drivers/xen/grant-table.c b/drivers/xen/grant-table.c index c254ae036f18..7786291ba229 100644 --- a/drivers/xen/grant-table.c +++ b/drivers/xen/grant-table.c @@ -592,7 +592,7 @@ static int grow_gnttab_list(unsigned int more_frames) return 0; grow_nomem: - for ( ; i >= nr_glist_frames; i--) + while (i-- > nr_glist_frames) free_page((unsigned long) gnttab_list[i]); return -ENOMEM; } -- cgit v1.2.3