* [PATCH] mmc: Fix error checking
@ 2023-05-17 16:46 Yeqi Fu
0 siblings, 0 replies; only message in thread
From: Yeqi Fu @ 2023-05-17 16:46 UTC (permalink / raw)
To: ulf.hansson, CLoehle; +Cc: Yeqi Fu, linux-mmc, linux-kernel, Ivan Orlov
The functions debugfs_create_dir and debugfs_create_file_unsafe return
ERR_PTR if an error occurs, and the appropriate way to verify for errors
is to use the inline function IS_ERR. The patch will substitute the
null-comparison with IS_ERR.
Signed-off-by: Yeqi Fu <asuk4.q@gmail.com>
Suggested-by: Ivan Orlov <ivan.orlov0322@gmail.com>
---
drivers/mmc/core/block.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index 00c33edb9fb9..507bebc22636 100644
--- a/drivers/mmc/core/block.c
+++ b/drivers/mmc/core/block.c
@@ -2908,7 +2908,7 @@ static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
debugfs_create_file_unsafe("status", 0400, root,
card,
&mmc_dbg_card_status_fops);
- if (!md->status_dentry)
+ if (IS_ERR(md->status_dentry))
return -EIO;
}
@@ -2916,7 +2916,7 @@ static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
md->ext_csd_dentry =
debugfs_create_file("ext_csd", S_IRUSR, root, card,
&mmc_dbg_ext_csd_fops);
- if (!md->ext_csd_dentry)
+ if (IS_ERR(md->ext_csd_dentry))
return -EIO;
}
--
2.37.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-05-17 16:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-17 16:46 [PATCH] mmc: Fix error checking Yeqi Fu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®