Skip to contentSkip to conversation

mmc: Fix error checking

PATCH New Yeqi Fu 1 participant 1 message May 17, 2023 MMC, SD and SDIO

lore
Share & tools
lore

Yeqi Fu

author
#0 lore raw

PATCH 1/1 mmc: Fix error checking

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.

---
 drivers/mmc/core/block.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/core/block.c +2 -2
index 00c33edb9fb9..507bebc22636 100644
@@ -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;
 	}
 
Signature · 1 line
2.37.2