* [PATCH] video: fbdev: Request IO ports
@ 2026-11-11 15:02 Daniel Matyas
2026-11-11 16:14 ` sashiko-bot
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Matyas @ 2026-11-11 15:02 UTC (permalink / raw)
To: Jaya Kumar
Cc: Thomas Zimmermann, Helge Deller, linux-fbdev, dri-devel,
linux-kernel, Daniel Matyas
Some fbdev drivers do not request their memory correctly. Request the IO
ports' memory so no other driver may access them. Only request 1 byte,
because the inb() and out() are used for reading and writing.
Did not test on hardware.
Signed-off-by: Daniel Matyas <matyasdaniel006@gmail.com>
---
drivers/video/fbdev/arcfb.c | 8 ++++++++
drivers/video/fbdev/n411.c | 5 +++++
2 files changed, 13 insertions(+)
diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c
index b807cf07522d..6771a7409cde 100644
--- a/drivers/video/fbdev/arcfb.c
+++ b/drivers/video/fbdev/arcfb.c
@@ -481,6 +481,14 @@ static int arcfb_probe(struct platform_device *dev)
printk(KERN_WARNING "no IO addresses supplied\n");
goto err_addr;
}
+
+ if (!devm_request_region(&dev->dev, dio_addr, 1, "arcfb") ||
+ !devm_request_region(&dev->dev, cio_addr, 1, "arcfb") ||
+ !devm_request_region(&dev->dev, c2io_addr, 1, "arcfb")) {
+ retval = -EBUSY;
+ goto err_addr;
+ }
+
par->dio_addr = dio_addr;
par->cio_addr = cio_addr;
par->c2io_addr = c2io_addr;
diff --git a/drivers/video/fbdev/n411.c b/drivers/video/fbdev/n411.c
index a3677313396e..ed0281939d37 100644
--- a/drivers/video/fbdev/n411.c
+++ b/drivers/video/fbdev/n411.c
@@ -165,6 +165,11 @@ static int __init n411_init(void)
if (!n411_device)
return -ENOMEM;
+ if (!devm_request_region(&n411_device->dev, dio_addr, 1, "n411") ||
+ !devm_request_region(&n411_device->dev, cio_addr, 1, "n411") ||
+ !devm_request_region(&n411_device->dev, c2io_addr, 1, "n411"))
+ return -EBUSY;
+
ret = platform_device_add_data(n411_device, &n411_board,
sizeof(n411_board));
if (ret)
--
2.55.0
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] video: fbdev: Request IO ports
2026-11-11 15:02 [PATCH] video: fbdev: Request IO ports Daniel Matyas
@ 2026-11-11 16:14 ` sashiko-bot
0 siblings, 0 replies; 2+ messages in thread
From: sashiko-bot @ 2026-11-11 16:14 UTC (permalink / raw)
To: Daniel Matyas; +Cc: dri-devel
Thank you for your contribution! Sashiko AI review found 2 potential
issues to consider:
- [High] fbdev: n411: devm_request_region() in n411_init() breaks
hecubafb probing
- [Medium] fbdev: n411: leak of n411_device and I/O regions in
n411_init() on error
--
commit 233a6d07f214976aca6e2d815559082f7aaf9dc7
Author: Daniel Matyas <matyasdaniel006@gmail.com>
video: fbdev: Request IO ports
This commit requests the I/O port regions used by the arcfb and n411
framebuffer drivers via devm_request_region().
> diff --git a/drivers/video/fbdev/n411.c b/drivers/video/fbdev/n411.c
> index a3677313396e2..ed0281939d37d 100644
> --- a/drivers/video/fbdev/n411.c
> +++ b/drivers/video/fbdev/n411.c
> @@ -165,6 +165,11 @@ static int __init n411_init(void)
> if (!n411_device)
> return -ENOMEM;
>
> + if (!devm_request_region(&n411_device->dev, dio_addr, 1, "n411") ||
> + !devm_request_region(&n411_device->dev, cio_addr, 1, "n411") ||
> + !devm_request_region(&n411_device->dev, c2io_addr, 1, "n411"))
[Severity: High]
Does calling devm_request_region() on &n411_device->dev before
platform_device_add() prevent the hecubafb driver from binding to
n411_device?
Each devm_request_region() call adds an entry to
n411_device->dev.devres_head. When platform_device_add(n411_device) later
attempts to bind the driver, really_probe() rejects any device that already
has devres entries:
drivers/base/dd.c:really_probe() {
...
if (!list_empty(&dev->devres_head)) {
dev_crit(dev, "Resources present before probing\n");
ret = -EBUSY;
goto done;
}
...
}
As a result, probing always fails with -EBUSY and the display device remains
unbound.
> + return -EBUSY;
[Severity: Medium]
Does returning -EBUSY directly here leak n411_device and any I/O port
regions already claimed by the preceding devm_request_region() calls?
Jumping to put_plat_device instead would call platform_device_put() and
release the allocated device and its managed resources.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261111150219.239706-1-matyasdaniel006@gmail.com?part=1
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-11 16:15 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-11 15:02 [PATCH] video: fbdev: Request IO ports Daniel Matyas
2026-11-11 16:14 ` sashiko-bot
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.