All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] omap_ssi_port.c: Drop error checking for debugfs_create_dir
@ 2023-05-25 15:38 Osama Muhammad
  2023-05-27 16:54 ` Sebastian Reichel
  0 siblings, 1 reply; 2+ messages in thread
From: Osama Muhammad @ 2023-05-25 15:38 UTC (permalink / raw)
  To: sre, jinpu.wang; +Cc: linux-kernel, Osama Muhammad

This patch fixes the error checking in spi-dw-core.c in
omap_ssi_port.c. The DebugFS kernel API is developed in
a way that the caller can safely ignore the errors that
occur during the creation of DebugFS nodes.

Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
---
 drivers/hsi/controllers/omap_ssi_port.c | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
index 7ad41599baa5..8feb91d256fd 100644
--- a/drivers/hsi/controllers/omap_ssi_port.c
+++ b/drivers/hsi/controllers/omap_ssi_port.c
@@ -151,23 +151,20 @@ static int ssi_div_set(void *data, u64 val)
 
 DEFINE_DEBUGFS_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
 
-static int ssi_debug_add_port(struct omap_ssi_port *omap_port,
+static void ssi_debug_add_port(struct omap_ssi_port *omap_port,
 				     struct dentry *dir)
 {
 	struct hsi_port *port = to_hsi_port(omap_port->dev);
 
 	dir = debugfs_create_dir(dev_name(omap_port->dev), dir);
-	if (IS_ERR(dir))
-		return -ENOMEM;
+
 	omap_port->dir = dir;
 	debugfs_create_file("regs", S_IRUGO, dir, port, &ssi_port_regs_fops);
 	dir = debugfs_create_dir("sst", dir);
-	if (IS_ERR(dir))
-		return -ENOMEM;
+
 	debugfs_create_file_unsafe("divisor", 0644, dir, port,
 				   &ssi_sst_div_fops);
 
-	return 0;
 }
 #endif
 
@@ -1217,11 +1214,8 @@ static int ssi_port_probe(struct platform_device *pd)
 	pm_runtime_enable(omap_port->pdev);
 
 #ifdef CONFIG_DEBUG_FS
-	err = ssi_debug_add_port(omap_port, omap_ssi->dir);
-	if (err < 0) {
-		pm_runtime_disable(omap_port->pdev);
-		goto error;
-	}
+	 ssi_debug_add_port(omap_port, omap_ssi->dir);
+
 #endif
 
 	hsi_add_clients_from_dt(port, np);
-- 
2.34.1


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

* Re: [PATCH] omap_ssi_port.c: Drop error checking for debugfs_create_dir
  2023-05-25 15:38 [PATCH] omap_ssi_port.c: Drop error checking for debugfs_create_dir Osama Muhammad
@ 2023-05-27 16:54 ` Sebastian Reichel
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2023-05-27 16:54 UTC (permalink / raw)
  To: Osama Muhammad; +Cc: jinpu.wang, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 2031 bytes --]

Hi,

On Thu, May 25, 2023 at 08:38:37PM +0500, Osama Muhammad wrote:
> This patch fixes the error checking in spi-dw-core.c in
> omap_ssi_port.c. The DebugFS kernel API is developed in
> a way that the caller can safely ignore the errors that
> occur during the creation of DebugFS nodes.
> 
> Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
> ---

Thanks, queued.

-- Sebastian

>  drivers/hsi/controllers/omap_ssi_port.c | 16 +++++-----------
>  1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
> index 7ad41599baa5..8feb91d256fd 100644
> --- a/drivers/hsi/controllers/omap_ssi_port.c
> +++ b/drivers/hsi/controllers/omap_ssi_port.c
> @@ -151,23 +151,20 @@ static int ssi_div_set(void *data, u64 val)
>  
>  DEFINE_DEBUGFS_ATTRIBUTE(ssi_sst_div_fops, ssi_div_get, ssi_div_set, "%llu\n");
>  
> -static int ssi_debug_add_port(struct omap_ssi_port *omap_port,
> +static void ssi_debug_add_port(struct omap_ssi_port *omap_port,
>  				     struct dentry *dir)
>  {
>  	struct hsi_port *port = to_hsi_port(omap_port->dev);
>  
>  	dir = debugfs_create_dir(dev_name(omap_port->dev), dir);
> -	if (IS_ERR(dir))
> -		return -ENOMEM;
> +
>  	omap_port->dir = dir;
>  	debugfs_create_file("regs", S_IRUGO, dir, port, &ssi_port_regs_fops);
>  	dir = debugfs_create_dir("sst", dir);
> -	if (IS_ERR(dir))
> -		return -ENOMEM;
> +
>  	debugfs_create_file_unsafe("divisor", 0644, dir, port,
>  				   &ssi_sst_div_fops);
>  
> -	return 0;
>  }
>  #endif
>  
> @@ -1217,11 +1214,8 @@ static int ssi_port_probe(struct platform_device *pd)
>  	pm_runtime_enable(omap_port->pdev);
>  
>  #ifdef CONFIG_DEBUG_FS
> -	err = ssi_debug_add_port(omap_port, omap_ssi->dir);
> -	if (err < 0) {
> -		pm_runtime_disable(omap_port->pdev);
> -		goto error;
> -	}
> +	 ssi_debug_add_port(omap_port, omap_ssi->dir);
> +
>  #endif
>  
>  	hsi_add_clients_from_dt(port, np);
> -- 
> 2.34.1
> 

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2023-05-27 16:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-25 15:38 [PATCH] omap_ssi_port.c: Drop error checking for debugfs_create_dir Osama Muhammad
2023-05-27 16:54 ` Sebastian Reichel

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.