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?
Thanks,
Ingyu Jang