* [PATCH] fbdev: wmt_ge_rops: use devm_platform_ioremap_resource()
@ 2026-03-04 17:10 Amin GATTOUT
2026-03-05 3:20 ` Claude review: " Claude Code Review Bot
2026-03-05 3:20 ` Claude Code Review Bot
0 siblings, 2 replies; 3+ messages in thread
From: Amin GATTOUT @ 2026-03-04 17:10 UTC (permalink / raw)
To: Alexey Charkov, Krzysztof Kozlowski, Helge Deller
Cc: linux-arm-kernel, linux-fbdev, dri-devel, linux-kernel,
Thomas Zimmermann, Amin GATTOUT
Replace the open-coded platform_get_resource() + ioremap() pair with
devm_platform_ioremap_resource(), which requests the memory region and
maps it in a single call, with automatic cleanup on device removal.
Also reset regbase to NULL in remove() so that the single-instance
guard in probe() works correctly if the device is re-probed.
Signed-off-by: Amin GATTOUT <amin.gattout@gmail.com>
---
drivers/video/fbdev/wmt_ge_rops.c | 18 ++++--------------
1 file changed, 4 insertions(+), 14 deletions(-)
diff --git a/drivers/video/fbdev/wmt_ge_rops.c b/drivers/video/fbdev/wmt_ge_rops.c
index 2bd26bfb2b46..0cf78bcadfa6 100644
--- a/drivers/video/fbdev/wmt_ge_rops.c
+++ b/drivers/video/fbdev/wmt_ge_rops.c
@@ -148,25 +148,15 @@ EXPORT_SYMBOL_GPL(wmt_ge_sync);
static int wmt_ge_rops_probe(struct platform_device *pdev)
{
- struct resource *res;
-
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (res == NULL) {
- dev_err(&pdev->dev, "no I/O memory resource defined\n");
- return -ENODEV;
- }
-
/* Only one ROP engine is presently supported. */
if (unlikely(regbase)) {
WARN_ON(1);
return -EBUSY;
}
- regbase = ioremap(res->start, resource_size(res));
- if (regbase == NULL) {
- dev_err(&pdev->dev, "failed to map I/O memory\n");
- return -EBUSY;
- }
+ regbase = devm_platform_ioremap_resource(pdev, 0);
+ if (IS_ERR(regbase))
+ return PTR_ERR(regbase);
writel(1, regbase + GE_ENABLE_OFF);
printk(KERN_INFO "Enabled support for WMT GE raster acceleration\n");
@@ -176,7 +166,7 @@ static int wmt_ge_rops_probe(struct platform_device *pdev)
static void wmt_ge_rops_remove(struct platform_device *pdev)
{
- iounmap(regbase);
+ regbase = NULL;
}
static const struct of_device_id wmt_dt_ids[] = {
---
base-commit: 11439c4635edd669ae435eec308f4ab8a0804808
change-id: 20260303-master-4dbb344c9a39
Best regards,
--
Amin GATTOUT <amin.gattout@gmail.com>
^ permalink raw reply related [flat|nested] 3+ messages in thread* Claude review: fbdev: wmt_ge_rops: use devm_platform_ioremap_resource()
2026-03-04 17:10 [PATCH] fbdev: wmt_ge_rops: use devm_platform_ioremap_resource() Amin GATTOUT
@ 2026-03-05 3:20 ` Claude Code Review Bot
2026-03-05 3:20 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-05 3:20 UTC (permalink / raw)
To: dri-devel-reviews
Patch Review
**Bug: `regbase` left as ERR_PTR on probe failure**
When `devm_platform_ioremap_resource()` fails, it returns an ERR_PTR value which gets assigned to `regbase`. The function then returns the error code, but `regbase` is left holding a non-NULL error-pointer value. On a subsequent probe attempt (or re-probe), the single-instance guard at line 152:
```c
if (unlikely(regbase)) {
WARN_ON(1);
return -EBUSY;
}
```
will see the stale ERR_PTR as non-NULL, fire the WARN_ON, and return `-EBUSY` — permanently blocking the driver from ever probing successfully again.
Fix: reset `regbase` to NULL in the error path:
```c
regbase = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(regbase)) {
int ret = PTR_ERR(regbase);
regbase = NULL;
return ret;
}
```
**Removal of `iounmap()` is correct** — `devm_platform_ioremap_resource()` registers a devres action that automatically unmaps on device removal, so the explicit `iounmap()` must go. Setting `regbase = NULL` in `remove()` is the right thing to do for the re-probe guard.
**Minor: no `dev_err` on failure** — The original code printed `"failed to map I/O memory"` on failure. `devm_platform_ioremap_resource()` does emit its own error messages internally, so dropping the explicit `dev_err` is fine.
**Overall:** The patch needs a v2 to fix the ERR_PTR-in-`regbase` issue on the error path. Otherwise the conversion is clean and correct.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread* Claude review: fbdev: wmt_ge_rops: use devm_platform_ioremap_resource()
2026-03-04 17:10 [PATCH] fbdev: wmt_ge_rops: use devm_platform_ioremap_resource() Amin GATTOUT
2026-03-05 3:20 ` Claude review: " Claude Code Review Bot
@ 2026-03-05 3:20 ` Claude Code Review Bot
1 sibling, 0 replies; 3+ messages in thread
From: Claude Code Review Bot @ 2026-03-05 3:20 UTC (permalink / raw)
To: dri-devel-reviews
Overall Series Review
Subject: fbdev: wmt_ge_rops: use devm_platform_ioremap_resource()
Author: Amin GATTOUT <amin.gattout@gmail.com>
Patches: 1
Reviewed: 2026-03-05T13:20:54.380535
---
This is a single-patch cleanup converting `platform_get_resource()` + `ioremap()` to `devm_platform_ioremap_resource()` in the WMT GE raster ops fbdev driver. The conversion is straightforward and the intent is correct, but there is a bug introduced by the error path leaving `regbase` in an invalid state.
---
Generated by Claude Code Patch Reviewer
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-03-05 3:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 17:10 [PATCH] fbdev: wmt_ge_rops: use devm_platform_ioremap_resource() Amin GATTOUT
2026-03-05 3:20 ` Claude review: " Claude Code Review Bot
2026-03-05 3:20 ` Claude Code Review Bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox