megaraid_sas_debugfs.c: Fix error checking for debugfs_create_dir
Subsystems (2)
PATCH 1/1 megaraid_sas_debugfs.c: Fix error checking for debugfs_create_dir
This patch fixes the error checking in megaraid_sas_debugfs.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]>
Suggested-by Ivan Orlov <[email protected]>
--- drivers/scsi/megaraid/megaraid_sas_debugfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/megaraid/megaraid_sas_debugfs.c +4 -4
@@ -102,7 +102,7 @@ static const struct file_operations megasas_debugfs_raidmap_fops = {void megasas_init_debugfs (void ) { megasas_debugfs_root =debugfs_create_dir ("megaraid_sas" ,NULL ); -if (!megasas_debugfs_root) +if (IS_ERR (megasas_debugfs_root))pr_info ("Cannot create debugfs root\n" ); }
@@ -129,10 +129,10 @@ megasas_setup_debugfs(struct megasas_instance *instance)if (fusion) {snprintf (name,sizeof (name),"scsi_host%d" , instance->host->host_no); -if (!instance->debugfs_root) { +if (IS_ERR (instance->debugfs_root)) { instance->debugfs_root =debugfs_create_dir (name, megasas_debugfs_root); -if (!instance->debugfs_root) { +if (IS_ERR (instance->debugfs_root)) {dev_err (&instance->pdev->dev,"Cannot create per adapter debugfs directory\n" );return ;
@@ -144,7 +144,7 @@ megasas_setup_debugfs(struct megasas_instance *instance)debugfs_create_file (name,S_IRUGO , instance->debugfs_root, instance, &megasas_debugfs_raidmap_fops); -if (!instance->raidmap_dump) { +if (IS_ERR (instance->raidmap_dump)) {dev_err (&instance->pdev->dev,"Cannot create raidmap debugfs file\n" );debugfs_remove (instance->debugfs_root);
Signature · 1 line
2.34.1