* [PATCH] omap_ssi_port.c: Fix error checking for debugfs_create_dir
@ 2023-05-23 17:24 Osama Muhammad
2023-05-25 12:56 ` Sebastian Reichel
0 siblings, 1 reply; 2+ messages in thread
From: Osama Muhammad @ 2023-05-23 17:24 UTC (permalink / raw)
To: sre, jinpu.wang; +Cc: linux-kernel, Osama Muhammad
This patch fixes the error checking in omap_ssi_port.c in
debugfs_create_dir. The correct way to check if an error occurred
is 'IS_ERR' inline function.
Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
---
drivers/hsi/controllers/omap_ssi_port.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
index b9495b720f1b..7ad41599baa5 100644
--- a/drivers/hsi/controllers/omap_ssi_port.c
+++ b/drivers/hsi/controllers/omap_ssi_port.c
@@ -157,12 +157,12 @@ static int ssi_debug_add_port(struct omap_ssi_port *omap_port,
struct hsi_port *port = to_hsi_port(omap_port->dev);
dir = debugfs_create_dir(dev_name(omap_port->dev), dir);
- if (!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 (!dir)
+ if (IS_ERR(dir))
return -ENOMEM;
debugfs_create_file_unsafe("divisor", 0644, dir, port,
&ssi_sst_div_fops);
--
2.34.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] omap_ssi_port.c: Fix error checking for debugfs_create_dir
2023-05-23 17:24 [PATCH] omap_ssi_port.c: Fix error checking for debugfs_create_dir Osama Muhammad
@ 2023-05-25 12:56 ` Sebastian Reichel
0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Reichel @ 2023-05-25 12:56 UTC (permalink / raw)
To: Osama Muhammad; +Cc: jinpu.wang, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1528 bytes --]
Hi,
On Tue, May 23, 2023 at 10:24:34PM +0500, Osama Muhammad wrote:
> This patch fixes the error checking in omap_ssi_port.c in
> debugfs_create_dir. The correct way to check if an error occurred
> is 'IS_ERR' inline function.
>
> Signed-off-by: Osama Muhammad <osmtendev@gmail.com>
> ---
This masks the error code. But the proper fix is to just ignore any
errors as the help text for debugfs_create_dir() explains. Please send
a new patch removing the 'if (!dir) return -ENOMEM;'. Also the
function can be changed to be of type void afterwards.
Thanks,
-- Sebastian
> drivers/hsi/controllers/omap_ssi_port.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/hsi/controllers/omap_ssi_port.c b/drivers/hsi/controllers/omap_ssi_port.c
> index b9495b720f1b..7ad41599baa5 100644
> --- a/drivers/hsi/controllers/omap_ssi_port.c
> +++ b/drivers/hsi/controllers/omap_ssi_port.c
> @@ -157,12 +157,12 @@ static int ssi_debug_add_port(struct omap_ssi_port *omap_port,
> struct hsi_port *port = to_hsi_port(omap_port->dev);
>
> dir = debugfs_create_dir(dev_name(omap_port->dev), dir);
> - if (!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 (!dir)
> + if (IS_ERR(dir))
> return -ENOMEM;
> debugfs_create_file_unsafe("divisor", 0644, dir, port,
> &ssi_sst_div_fops);
> --
> 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-25 12:57 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-23 17:24 [PATCH] omap_ssi_port.c: Fix error checking for debugfs_create_dir Osama Muhammad
2023-05-25 12:56 ` Sebastian Reichel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox