Hi

Am 31.01.26 um 16:10 schrieb Ingyu Jang:
Hi,

I noticed that in drivers/video/aperture.c, the function
aperture_remove_conflicting_devices() always returns 0.

The function (at line 284) simply performs:
   - sysfb_disable(NULL)
   - aperture_detach_devices(base, size)
   - return 0

The wrapper function aperture_remove_all_conflicting_devices()
in include/linux/aperture.h (line 57) calls this function
and also always returns 0.

However, multiple DRM drivers check the return value and have
error handling:

1. drivers/gpu/drm/vc4/vc4_drv.c (line 364):
    ret = aperture_remove_all_conflicting_devices(driver->name);
    if (ret)
        goto err;

2. drivers/gpu/drm/sun4i/sun4i_drv.c (line 103):
    ret = aperture_remove_all_conflicting_devices(sun4i_drv_driver.name);
    if (ret)
        goto unbind_all;

Since aperture_remove_conflicting_devices() never fails, these
error paths appear to be dead code.

Is this intentional defensive coding for potential future changes,
or could this be cleaned up by making the function return void?

Yeah, it's mostly for completeness. But I would not want to change it unless we can rule out any future failures as well. Because if there's chance that the old device is still around, we should not load the new driver.

The _pci_ helper also calls vga_remove_vgacon(), which can fail. But that failure also looks related to errors in the kernel config.

Best regards
Thomas


Thanks,
Ingyu Jang

--
--
Thomas Zimmermann
Graphics Driver Developer
SUSE Software Solutions Germany GmbH
Frankenstr. 146, 90461 Nürnberg, Germany, www.suse.com
GF: Jochen Jaser, Andrew McDonald, Werner Knoblich, (HRB 36809, AG Nürnberg)


Reply via email to