Re: [PATCH] video: hpfb: Unregister DIO driver on init failure
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: 2026-06-24 08:51:25
Also in:
dri-devel, linux-m68k, lkml
Hi Haoxiang, CC hp300 On Tue, 23 Jun 2026 at 06:41, Haoxiang Li [off-list ref] wrote:
hpfb_init() registers the DIO driver via dio_register_driver(). If a later error occurs, the function returns directly without unregistering the DIO driver. Unregister the DIO driver before returning from these error paths. Signed-off-by: Haoxiang Li <redacted>
Thanks for your patch, which is now commit d6c3e2402523ce01 ("fbdev:
hpfb: Unregister DIO driver on init failure") in fbdev/for-next
quoted hunk ↗ jump to hunk
--- a/drivers/video/fbdev/hpfb.c +++ b/drivers/video/fbdev/hpfb.c@@ -407,10 +407,13 @@ static int __init hpfb_init(void)
As per the comment out-of-context above, this driver supports devices
on two types of buses:
/* Topcats can be on the internal IO bus or real DIO devices.
* The internal variant sits at 0x560000; it has primary
* and secondary ID registers just like the DIO version.
* So we merge the two detection routines.
err = copy_from_kernel_nofault(&i, (unsigned char *)INTFBVADDR + DIO_IDOFF, 1);
if (!err && (i == DIO_ID_FBUFFER) && topcat_sid_ok(sid = DIO_SECID(INTFBVADDR))) {
- if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat"))
+ if (!request_mem_region(INTFBPADDR, DIO_DEVSIZE, "Internal Topcat")) {
+ dio_unregister_driver(&hpfb_driver);
return -EBUSY;
+ }
printk(KERN_INFO "Internal Topcat found (secondary id %02x)\n", sid);
if (hpfb_init_one(INTFBPADDR, INTFBVADDR)) {
+ dio_unregister_driver(&hpfb_driver);
return -ENOMEM;
}
}
Hence if the detection or initialization on the internal bus fails,
other devices on the DIO bus must not be force-unbound.
This is also the reason why any error returned by
copy_from_kernel_nofault() is not considered fatal.
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds