[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20230713050341.3736-1-duminjie@vivo.com>
Date: Thu, 13 Jul 2023 13:03:41 +0800
From: Minjie Du <duminjie@...o.com>
To: Sathya Prakash <sathya.prakash@...adcom.com>,
Sreekanth Reddy <sreekanth.reddy@...adcom.com>,
Suganath Prabu Subramani
<suganath-prabu.subramani@...adcom.com>,
"James E.J. Bottomley" <jejb@...ux.ibm.com>,
"Martin K. Petersen" <martin.petersen@...cle.com>,
MPT-FusionLinux.pdl@...adcom.com (open list:LSILOGIC MPT FUSION DRIVERS
(FC/SAS/SPI)),
linux-scsi@...r.kernel.org (open list:LSILOGIC MPT FUSION DRIVERS
(FC/SAS/SPI)), linux-kernel@...r.kernel.org (open list)
Cc: opensource.kernel@...o.com, Minjie Du <duminjie@...o.com>
Subject: [PATCH v1] drivers/scsi: mpt3sas: fix parameter check in two functions
Make IS_ERR() judge the debugfs_create_dir() and debugfs_create_file()
function return in mpt3sas_init_debugfs() and mpt3sas_setup_debugfs().
Signed-off-by: Minjie Du <duminjie@...o.com>
---
drivers/scsi/mpt3sas/mpt3sas_debugfs.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/scsi/mpt3sas/mpt3sas_debugfs.c b/drivers/scsi/mpt3sas/mpt3sas_debugfs.c
index a6ab1db81..88fc10ad0 100644
--- a/drivers/scsi/mpt3sas/mpt3sas_debugfs.c
+++ b/drivers/scsi/mpt3sas/mpt3sas_debugfs.c
@@ -99,7 +99,7 @@ static const struct file_operations mpt3sas_debugfs_iocdump_fops = {
void mpt3sas_init_debugfs(void)
{
mpt3sas_debugfs_root = debugfs_create_dir("mpt3sas", NULL);
- if (!mpt3sas_debugfs_root)
+ if (IS_ERR(mpt3sas_debugfs_root))
pr_info("mpt3sas: Cannot create debugfs root\n");
}
@@ -124,7 +124,7 @@ mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc)
if (!ioc->debugfs_root) {
ioc->debugfs_root =
debugfs_create_dir(name, mpt3sas_debugfs_root);
- if (!ioc->debugfs_root) {
+ if (IS_ERR(ioc->debugfs_root)) {
dev_err(&ioc->pdev->dev,
"Cannot create per adapter debugfs directory\n");
return;
@@ -134,7 +134,7 @@ mpt3sas_setup_debugfs(struct MPT3SAS_ADAPTER *ioc)
snprintf(name, sizeof(name), "ioc_dump");
ioc->ioc_dump = debugfs_create_file(name, 0444,
ioc->debugfs_root, ioc, &mpt3sas_debugfs_iocdump_fops);
- if (!ioc->ioc_dump) {
+ if (IS_ERR(ioc->ioc_dump)) {
dev_err(&ioc->pdev->dev,
"Cannot create ioc_dump debugfs file\n");
debugfs_remove(ioc->debugfs_root);
--
2.39.0
Powered by blists - more mailing lists