All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] video: hyperv_fb: Reduce scope for the variable “page” in hvfb_get_phymem()
@ 2020-12-10 16:17 Markus Elfring
  0 siblings, 0 replies; only message in thread
From: Markus Elfring @ 2020-12-10 16:17 UTC (permalink / raw)
  To: linux-hyperv, linux-fbdev, dri-devel, Haiyang Zhang,
	K. Y. Srinivasan, Stephen Hemminger, Wei Liu
  Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Thu, 10 Dec 2020 17:00:13 +0100

A local variable was used only within an if branch.
Thus move the definition for the variable “page” into the corresponding
code block.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 drivers/video/fbdev/hyperv_fb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c
index c8b0ae676809..e18fa8793608 100644
--- a/drivers/video/fbdev/hyperv_fb.c
+++ b/drivers/video/fbdev/hyperv_fb.c
@@ -961,7 +961,6 @@ static void hvfb_get_option(struct fb_info *info)
 static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,
 				   unsigned int request_size)
 {
-	struct page *page = NULL;
 	dma_addr_t dma_handle;
 	void *vmem;
 	phys_addr_t paddr = 0;
@@ -972,7 +971,7 @@ static phys_addr_t hvfb_get_phymem(struct hv_device *hdev,

 	if (order < MAX_ORDER) {
 		/* Call alloc_pages if the size is less than 2^MAX_ORDER */
-		page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
+		struct page *page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
 		if (!page)
 			return -1;

--
2.29.2

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-11  8:16 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-10 16:17 [PATCH] video: hyperv_fb: Reduce scope for the variable “page” in hvfb_get_phymem() Markus Elfring

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.