Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

vmw_balloon: fix for a -Wuninitialized warning

Fix for a -Wuninitialized compiler warning. Changed return value of
vmballoon_send_lock_page() from bool to int to be able to distinguish
between the error cases to avoid uninitialized use of hv_status in
vmballoon_reserve_page()

Signed-off-by: Danny Kukawka <danny.kukawka@bisect.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Danny Kukawka and committed by
Greg Kroah-Hartman
3e5ba466 7c5763b8

+7 -7
+7 -7
drivers/misc/vmw_balloon.c
··· 314 314 * fear that guest will need it. Host may reject some pages, we need to 315 315 * check the return value and maybe submit a different page. 316 316 */ 317 - static bool vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, 317 + static int vmballoon_send_lock_page(struct vmballoon *b, unsigned long pfn, 318 318 unsigned int *hv_status) 319 319 { 320 320 unsigned long status, dummy; ··· 322 322 323 323 pfn32 = (u32)pfn; 324 324 if (pfn32 != pfn) 325 - return false; 325 + return -1; 326 326 327 327 STATS_INC(b->stats.lock); 328 328 329 329 *hv_status = status = VMWARE_BALLOON_CMD(LOCK, pfn, dummy); 330 330 if (vmballoon_check_status(b, status)) 331 - return true; 331 + return 0; 332 332 333 333 pr_debug("%s - ppn %lx, hv returns %ld\n", __func__, pfn, status); 334 334 STATS_INC(b->stats.lock_fail); 335 - return false; 335 + return 1; 336 336 } 337 337 338 338 /* ··· 411 411 struct page *page; 412 412 gfp_t flags; 413 413 unsigned int hv_status; 414 - bool locked = false; 414 + int locked; 415 415 flags = can_sleep ? VMW_PAGE_ALLOC_CANSLEEP : VMW_PAGE_ALLOC_NOSLEEP; 416 416 417 417 do { ··· 431 431 432 432 /* inform monitor */ 433 433 locked = vmballoon_send_lock_page(b, page_to_pfn(page), &hv_status); 434 - if (!locked) { 434 + if (locked > 0) { 435 435 STATS_INC(b->stats.refused_alloc); 436 436 437 437 if (hv_status == VMW_BALLOON_ERROR_RESET || ··· 449 449 if (++b->n_refused_pages >= VMW_BALLOON_MAX_REFUSED) 450 450 return -EIO; 451 451 } 452 - } while (!locked); 452 + } while (locked != 0); 453 453 454 454 /* track allocated page */ 455 455 list_add(&page->lru, &b->pages);