Re: [PATCH 1/2] drm/debugfs: remove checks for return value of drm_debugfs functions.
From: Daniel Vetter
Date: Tue Feb 18 2020 - 14:09:47 EST
On Tue, Feb 18, 2020 at 08:28:14PM +0300, Wambui Karuga wrote:
> As there is no need to check the return value of
> drm_debugfs_create_files, remove unnecessary checks and error handling
> statement blocks.
>
> Signed-off-by: Wambui Karuga <wambui.karugax@xxxxxxxxx>
I'd split this up a bit differently, with a patch per function. But then
including in that patch the prototype change (at least for the
drm-internal ones that aren't used by drivers). This way reviewers don't
have to check the entire series to make sure that we drop the now
pointeless return value from the implementation of these functions.
I guess you could also just squash this function into the last one, it's a
fairly small patch still.
-Daniel
> ---
> drivers/gpu/drm/drm_debugfs.c | 28 +++++-----------------------
> 1 file changed, 5 insertions(+), 23 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index 4e673d318503..6a2f141b6a38 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -215,35 +215,17 @@ int drm_debugfs_init(struct drm_minor *minor, int minor_id,
> sprintf(name, "%d", minor_id);
> minor->debugfs_root = debugfs_create_dir(name, root);
>
> - ret = drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
> - minor->debugfs_root, minor);
> - if (ret) {
> - debugfs_remove(minor->debugfs_root);
> - minor->debugfs_root = NULL;
> - DRM_ERROR("Failed to create core drm debugfs files\n");
> - return ret;
> - }
> + drm_debugfs_create_files(drm_debugfs_list, DRM_DEBUGFS_ENTRIES,
> + minor->debugfs_root, minor);
>
> if (drm_drv_uses_atomic_modeset(dev)) {
> - ret = drm_atomic_debugfs_init(minor);
> - if (ret) {
> - DRM_ERROR("Failed to create atomic debugfs files\n");
> - return ret;
> - }
> + drm_atomic_debugfs_init(minor);
> }
>
> if (drm_core_check_feature(dev, DRIVER_MODESET)) {
> - ret = drm_framebuffer_debugfs_init(minor);
> - if (ret) {
> - DRM_ERROR("Failed to create framebuffer debugfs file\n");
> - return ret;
> - }
> + drm_framebuffer_debugfs_init(minor);
>
> - ret = drm_client_debugfs_init(minor);
> - if (ret) {
> - DRM_ERROR("Failed to create client debugfs file\n");
> - return ret;
> - }
> + drm_client_debugfs_init(minor);
> }
>
> if (dev->driver->debugfs_init) {
> --
> 2.25.0
>
--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch