[PATCH] malidp: no need to check return value of debugfs_create functions
Liviu Dudau
liviu.dudau at arm.com
Thu Jun 13 14:52:22 UTC 2019
On Thu, Jun 13, 2019 at 03:28:29PM +0200, Greg Kroah-Hartman wrote:
> When calling debugfs functions, there is no need to ever check the
> return value. The function can work or not, but the code logic should
> never do something different based on this.
I remember when writing this code and testing not fully complete code that left
nodes around on removing the module that there were errors being returned by
debugfs_create_file(). Has that changed since 2 years ago? :)
>
> Cc: Liviu Dudau <liviu.dudau at arm.com>
> Cc: Brian Starkey <brian.starkey at arm.com>
> Cc: David Airlie <airlied at linux.ie>
> Cc: Daniel Vetter <daniel at ffwll.ch>
> Cc: dri-devel at lists.freedesktop.org
> Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
Acked-by: Liviu Dudau <liviu.dudau at arm.com>
I'll pull it into the malidp tree.
Best regards,
Liviu
> ---
> drivers/gpu/drm/arm/malidp_drv.c | 11 ++---------
> 1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 21725c9b9f5e..7d732423d70d 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -542,19 +542,12 @@ static const struct file_operations malidp_debugfs_fops = {
> static int malidp_debugfs_init(struct drm_minor *minor)
> {
> struct malidp_drm *malidp = minor->dev->dev_private;
> - struct dentry *dentry = NULL;
>
> malidp_error_stats_init(&malidp->de_errors);
> malidp_error_stats_init(&malidp->se_errors);
> spin_lock_init(&malidp->errors_lock);
> - dentry = debugfs_create_file("debug",
> - S_IRUGO | S_IWUSR,
> - minor->debugfs_root, minor->dev,
> - &malidp_debugfs_fops);
> - if (!dentry) {
> - DRM_ERROR("Cannot create debug file\n");
> - return -ENOMEM;
> - }
> + debugfs_create_file("debug", S_IRUGO | S_IWUSR, minor->debugfs_root,
> + minor->dev, &malidp_debugfs_fops);
> return 0;
> }
>
> --
> 2.22.0
>
--
====================
| I would like to |
| fix the world, |
| but they're not |
| giving me the |
\ source code! /
---------------
¯\_(ツ)_/¯
More information about the dri-devel
mailing list