[PATCH] panel: rocktech: no need to check return value of debugfs_create functions

Guido Günther agx at sigxcpu.org
Thu Jun 13 12:16:16 UTC 2019


Hi,
On Thu, Jun 13, 2019 at 01:57:17PM +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.
> 
> Cc: "Guido Günther" <agx at sigxcpu.org>
> Cc: Thierry Reding <thierry.reding at gmail.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>
> ---
>  drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c | 14 +++-----------
>  1 file changed, 3 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> index d88ea8da2ec2..6dcb692c4701 100644
> --- a/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> +++ b/drivers/gpu/drm/panel/panel-rocktech-jh057n00900.c
> @@ -257,20 +257,12 @@ static int allpixelson_set(void *data, u64 val)
>  DEFINE_SIMPLE_ATTRIBUTE(allpixelson_fops, NULL,
>  			allpixelson_set, "%llu\n");
>  
> -static int jh057n_debugfs_init(struct jh057n *ctx)
> +static void jh057n_debugfs_init(struct jh057n *ctx)
>  {
> -	struct dentry *f;
> -
>  	ctx->debugfs = debugfs_create_dir(DRV_NAME, NULL);
> -	if (!ctx->debugfs)
> -		return -ENOMEM;
>  
> -	f = debugfs_create_file("allpixelson", 0600,
> -				ctx->debugfs, ctx, &allpixelson_fops);
> -	if (!f)
> -		return -ENOMEM;
> -
> -	return 0;
> +	debugfs_create_file("allpixelson", 0600, ctx->debugfs, ctx,
> +			    &allpixelson_fops);
>  }
>  
>  static void jh057n_debugfs_remove(struct jh057n *ctx)

Reviewed-by: Guido Günther <agx at sigxcpu.org>

Thanks,
 -- Guido

> -- 
> 2.22.0
> 


More information about the dri-devel mailing list