All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: media: imx: no need to check return value of debugfs_create functions
@ 2020-04-28 17:04 Greg Kroah-Hartman
  2020-04-28 20:58 ` Rui Miguel Silva
  0 siblings, 1 reply; 2+ messages in thread
From: Greg Kroah-Hartman @ 2020-04-28 17:04 UTC (permalink / raw)
  To: Rui Miguel Silva, Steve Longerbeam, Philipp Zabel,
	Mauro Carvalho Chehab
  Cc: Greg Kroah-Hartman, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	linux-media, devel

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: Rui Miguel Silva <rmfrfs@gmail.com>
Cc: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: linux-media@vger.kernel.org
Cc: devel@driverdev.osuosl.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/staging/media/imx/imx7-mipi-csis.c | 29 ++++------------------
 1 file changed, 5 insertions(+), 24 deletions(-)

diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
index fbc1a924652a..d7c9e7343f1f 100644
--- a/drivers/staging/media/imx/imx7-mipi-csis.c
+++ b/drivers/staging/media/imx/imx7-mipi-csis.c
@@ -915,33 +915,14 @@ static int mipi_csis_dump_regs_show(struct seq_file *m, void *private)
 }
 DEFINE_SHOW_ATTRIBUTE(mipi_csis_dump_regs);
 
-static int mipi_csis_debugfs_init(struct csi_state *state)
+static void mipi_csis_debugfs_init(struct csi_state *state)
 {
-	struct dentry *d;
-
-	if (!debugfs_initialized())
-		return -ENODEV;
-
 	state->debugfs_root = debugfs_create_dir(dev_name(state->dev), NULL);
-	if (!state->debugfs_root)
-		return -ENOMEM;
-
-	d = debugfs_create_bool("debug_enable", 0600, state->debugfs_root,
-				&state->debug);
-	if (!d)
-		goto remove_debugfs;
-
-	d = debugfs_create_file("dump_regs", 0600, state->debugfs_root,
-				state, &mipi_csis_dump_regs_fops);
-	if (!d)
-		goto remove_debugfs;
-
-	return 0;
-
-remove_debugfs:
-	debugfs_remove_recursive(state->debugfs_root);
 
-	return -ENOMEM;
+	debugfs_create_bool("debug_enable", 0600, state->debugfs_root,
+			    &state->debug);
+	debugfs_create_file("dump_regs", 0600, state->debugfs_root, state,
+			    &mipi_csis_dump_regs_fops);
 }
 
 static void mipi_csis_debugfs_exit(struct csi_state *state)
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] staging: media: imx: no need to check return value of debugfs_create functions
  2020-04-28 17:04 [PATCH] staging: media: imx: no need to check return value of debugfs_create functions Greg Kroah-Hartman
@ 2020-04-28 20:58 ` Rui Miguel Silva
  0 siblings, 0 replies; 2+ messages in thread
From: Rui Miguel Silva @ 2020-04-28 20:58 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Steve Longerbeam, Philipp Zabel, Mauro Carvalho Chehab, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, linux-media, devel

Hi Greg,
Thanks for the cleanup.

On Tue, Apr 28, 2020 at 07:04:05PM +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: Rui Miguel Silva <rmfrfs@gmail.com>
> Cc: Steve Longerbeam <slongerbeam@gmail.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: linux-media@vger.kernel.org
> Cc: devel@driverdev.osuosl.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Reviewed-by: Rui Miguel Silva <rmfrfs@gmail.com>


Cheers,
     Rui
> ---
>  drivers/staging/media/imx/imx7-mipi-csis.c | 29 ++++------------------
>  1 file changed, 5 insertions(+), 24 deletions(-)
> 
> diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c
> index fbc1a924652a..d7c9e7343f1f 100644
> --- a/drivers/staging/media/imx/imx7-mipi-csis.c
> +++ b/drivers/staging/media/imx/imx7-mipi-csis.c
> @@ -915,33 +915,14 @@ static int mipi_csis_dump_regs_show(struct seq_file *m, void *private)
>  }
>  DEFINE_SHOW_ATTRIBUTE(mipi_csis_dump_regs);
>  
> -static int mipi_csis_debugfs_init(struct csi_state *state)
> +static void mipi_csis_debugfs_init(struct csi_state *state)
>  {
> -	struct dentry *d;
> -
> -	if (!debugfs_initialized())
> -		return -ENODEV;
> -
>  	state->debugfs_root = debugfs_create_dir(dev_name(state->dev), NULL);
> -	if (!state->debugfs_root)
> -		return -ENOMEM;
> -
> -	d = debugfs_create_bool("debug_enable", 0600, state->debugfs_root,
> -				&state->debug);
> -	if (!d)
> -		goto remove_debugfs;
> -
> -	d = debugfs_create_file("dump_regs", 0600, state->debugfs_root,
> -				state, &mipi_csis_dump_regs_fops);
> -	if (!d)
> -		goto remove_debugfs;
> -
> -	return 0;
> -
> -remove_debugfs:
> -	debugfs_remove_recursive(state->debugfs_root);
>  
> -	return -ENOMEM;
> +	debugfs_create_bool("debug_enable", 0600, state->debugfs_root,
> +			    &state->debug);
> +	debugfs_create_file("dump_regs", 0600, state->debugfs_root, state,
> +			    &mipi_csis_dump_regs_fops);
>  }
>  
>  static void mipi_csis_debugfs_exit(struct csi_state *state)
> -- 
> 2.26.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-04-28 20:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-28 17:04 [PATCH] staging: media: imx: no need to check return value of debugfs_create functions Greg Kroah-Hartman
2020-04-28 20:58 ` Rui Miguel Silva

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.