Thread (5 messages) flat view 5 messages, 4 authors, 11d ago

Re: [PATCH v2] fbdev: platinumfb: add error checking for ioremap calls

From: Nathan Chancellor <nathan@kernel.org>
Date: 2026-08-19 23:59:24
Also in: dri-devel, lkml
Subsystem: framebuffer layer, the rest · Maintainers: Helge Deller, Linus Torvalds

On Tue, Aug 18, 2026 at 11:03:07AM +0200, Helge Deller wrote:
On 8/17/26 08:39, yuebingkun wrote:
quoted
The ioremap() and ioremap_wt() calls in platinumfb_probe() were not
checked for failure. If any of these mappings fail, the driver would
dereference NULL pointers, leading to a kernel panic.

Add proper error checking and use goto-based cleanup to avoid code
duplication across the error paths.

Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
That Fixes line ^^^ has no value, so I dropped it.
quoted
Signed-off-by: yuebingkun <redacted>
Would be nice to have your Name written out here, e.g. Yue Bing Kun (or something),
but I've left it as-is for now. In case you resend with full name, I can replace it
in the git tree.
quoted
  drivers/video/fbdev/platinumfb.c | 36 ++++++++++++++++++++++++++------
  1 file changed, 30 insertions(+), 6 deletions(-)
Patch applied (with the Fixes line dropped).
This patch introduces a compiler warning for me:

  drivers/video/fbdev/platinumfb.c: In function 'platinumfb_probe':
  drivers/video/fbdev/platinumfb.c:650:1: warning: label 'err_unmap_regs' defined but not used [-Wunused-label]
    650 | err_unmap_regs:
        | ^~~~~~~~~~~~~~

As far as I can tell, it is unnecessary, so maybe this could be folded
in? Otherwise, I can send a formal patch.
diff --git a/drivers/video/fbdev/platinumfb.c b/drivers/video/fbdev/platinumfb.c
index f74c937c839f..81fdaa3541db 100644
--- a/drivers/video/fbdev/platinumfb.c
+++ b/drivers/video/fbdev/platinumfb.c
@@ -647,7 +647,6 @@ static int platinumfb_probe(struct platform_device* odev)
 	iounmap(pinfo->cmap_regs);
 err_release_cmap:
 	release_mem_region(pinfo->cmap_regs_phys, 0x1000);
-err_unmap_regs:
 	iounmap(pinfo->platinum_regs);
 err_unmap_fb:
 	iounmap(pinfo->frame_buffer);
-- 
Cheers,
Nathan
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help