public inbox for linux-fbdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Amit Barzilai <amit.barzilai22@gmail.com>
To: deller@gmx.de
Cc: thomas.zimmermann@suse.de, linux-fbdev@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	Amit Barzilai <amit.barzilai22@gmail.com>
Subject: [PATCH 3/3] fbdev: goldfishfb: Request memory region
Date: Mon, 20 Apr 2026 16:44:24 +0300	[thread overview]
Message-ID: <20260420134424.77494-4-amit.barzilai22@gmail.com> (raw)
In-Reply-To: <20260420134424.77494-1-amit.barzilai22@gmail.com>

Use devm_ioremap_resource() instead of plain ioremap(). The helper
requests the memory region before mapping it, which registers the range
in /proc/iomem and prevents another driver from mapping the same
registers. As it is device-managed, remove the corresponding iounmap()
calls from the error unwind path and the remove function.

Assisted-by: Claude:claude-sonnet-4-6
---
 drivers/video/fbdev/goldfishfb.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c
index ffe33a36b944..14a7cb0a7a1c 100644
--- a/drivers/video/fbdev/goldfishfb.c
+++ b/drivers/video/fbdev/goldfishfb.c
@@ -194,9 +194,9 @@ static int goldfish_fb_probe(struct platform_device *pdev)
 		ret = -ENODEV;
 		goto err_no_io_base;
 	}
-	fb->reg_base = ioremap(r->start, PAGE_SIZE);
-	if (fb->reg_base == NULL) {
-		ret = -ENOMEM;
+	fb->reg_base = devm_ioremap_resource(&pdev->dev, r);
+	if (IS_ERR(fb->reg_base)) {
+		ret = PTR_ERR(fb->reg_base);
 		goto err_no_io_base;
 	}
 
@@ -273,7 +273,6 @@ static int goldfish_fb_probe(struct platform_device *pdev)
 				fb->fb.fix.smem_start);
 err_alloc_screen_base_failed:
 err_no_irq:
-	iounmap(fb->reg_base);
 err_no_io_base:
 	kfree(fb);
 err_fb_alloc_failed:
@@ -291,7 +290,6 @@ static void goldfish_fb_remove(struct platform_device *pdev)
 
 	dma_free_coherent(&pdev->dev, framesize, (void *)fb->fb.screen_base,
 						fb->fb.fix.smem_start);
-	iounmap(fb->reg_base);
 	kfree(fb);
 }
 
-- 
2.53.0


  parent reply	other threads:[~2026-04-20 13:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-20 13:44 [PATCH 0/3] fbdev: Request memory regions in platform drivers Amit Barzilai
2026-04-20 13:44 ` [PATCH 1/3] fbdev: cobalt_lcdfb: Request memory region Amit Barzilai
2026-04-22 14:50   ` Helge Deller
2026-04-22 15:29     ` Amit Barzilai
2026-04-20 13:44 ` [PATCH 2/3] fbdev: clps711x-fb: Request memory region for MMIO Amit Barzilai
2026-04-20 13:44 ` Amit Barzilai [this message]
2026-04-22 14:43   ` [PATCH 3/3] fbdev: goldfishfb: Request memory region Helge Deller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260420134424.77494-4-amit.barzilai22@gmail.com \
    --to=amit.barzilai22@gmail.com \
    --cc=deller@gmx.de \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=thomas.zimmermann@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox