Returning error usually implies failure, in which case anything that has done should be properly reverted. Thus if failed in registering /dev/vga_arbiter, it is better to just throw out a warning than returning error without unregistering pci_notifier. Signed-off-by: Abel Wu <abel.w@xxxxxxxxxx> --- drivers/gpu/vga/vgaarb.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c index 2879d4223bf1..eff6b78e3372 100644 --- a/drivers/gpu/vga/vgaarb.c +++ b/drivers/gpu/vga/vgaarb.c @@ -1537,13 +1537,11 @@ static void __init vga_arb_select_default_device(void) static int __init vga_arb_device_init(void) { - int rc; struct pci_dev *pdev = NULL; struct vga_device *vgadev; - rc = misc_register(&vga_arb_device); - if (rc < 0) - pr_err("error %d registering device\n", rc); + if (misc_register(&vga_arb_device)) + pr_warn("failed registering /dev/vga_arbiter\n"); bus_register_notifier(&pci_bus_type, &pci_notifier); @@ -1571,6 +1569,6 @@ static int __init vga_arb_device_init(void) vga_arb_select_default_device(); pr_info("loaded\n"); - return rc; + return 0; } subsys_initcall(vga_arb_device_init); -- 2.27.0 _______________________________________________ dri-devel mailing list dri-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/dri-devel