omap_ssi_port.c: Fix error checking for debugfs_create_dir
PATCH 1/1 omap_ssi_port.c: Fix error checking for debugfs_create_dir
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 <[email protected]>
--- drivers/hsi/controllers/omap_ssi_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hsi/controllers/omap_ssi_port.c +2 -2
@@ -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);
Signature · 1 line
2.34.1
Sebastian Reichel
maintainerHi,
Quoted 6 lines · Osama Muhammad
This patch fixes the error checking in
omap_ssi_port.cindebugfs_create_dir. The correct way to check if an error occurred is 'IS_ERR' inline function.Signed-off-by Osama Muhammad <[email protected]>---
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
Quoted 25 lines
drivers/hsi/controllers/omap_ssi_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/hsi/controllers/omap_ssi_port.c +2
-2@@ -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);Signature · 1 line
2.34.1