Skip to contentSkip to conversation

mmc: mmc_test: fix missing assignment of 'file' when register debugfs file

PATCH In review Ye Bin 3 participants 3 messages Nov 23, 2022 – Nov 29, 2022 MMC, SD and SDIO

lore
Share & tools
lore

Ye Bin

author
#0 lore raw

PATCH 1/1 mmc: mmc_test: fix missing assignment of 'file' when register debugfs file

From: Ye Bin <[email protected]>

Now, 'file' is always NULL. obviously, 'file' is used to store return value of 'debugfs_create_file()'.

Fixes a04c50aaa916 ("mmc: core: no need to check return value of debugfs_create functions")
---
 drivers/mmc/core/mmc_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/mmc_test.c +2 -1
index 6cd6f8a94a71..156d34b2ed4d 100644
@@ -3174,7 +3174,8 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
 	struct mmc_test_dbgfs_file *df;
 
 	if (card->debugfs_root)
-		debugfs_create_file(name, mode, card->debugfs_root, card, fops);
+		file = debugfs_create_file(name, mode, card->debugfs_root,
+					   card, fops);
 
 	df = kmalloc(sizeof(*df), GFP_KERNEL);
 	if (!df) {
Signature · 1 line
2.31.1
Acked-by on v1 1/1
#1 lore raw
Quoted 4 lines · Ye Bin

From: Ye Bin <[email protected]>

Now, 'file' is always NULL. obviously, 'file' is used to store return value of 'debugfs_create_file()'.

'file' is used to remove debugfs files when the mmc_test module is removed.

Quoted 3 lines
Fixes a04c50aaa916 ("mmc: core: no need to check return value of debugfs_create functions")
Quoted 18 lines
---
 drivers/mmc/core/mmc_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/mmc_test.c +2 -1
index 6cd6f8a94a71..156d34b2ed4d 100644
@@ -3174,7 +3174,8 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
 	struct mmc_test_dbgfs_file *df;
 
 	if (card->debugfs_root)
-		debugfs_create_file(name, mode, card->debugfs_root, card, fops);
+		file = debugfs_create_file(name, mode, card->debugfs_root,
+					   card, fops);
 
 	df = kmalloc(sizeof(*df), GFP_KERNEL);
 	if (!df) {
#2 lore raw
In reply to Ye Bin
Quoted 8 lines · Ye Bin

From: Ye Bin <[email protected]>

Now, 'file' is always NULL. obviously, 'file' is used to store return value of 'debugfs_create_file()'.

Fixes a04c50aaa916 ("mmc: core: no need to check return value of debugfs_create functions")

Applied for fixes, by amending the commit message and by adding a stable tag, thanks!

Kind regards
Uffe

Quoted 21 lines
---
 drivers/mmc/core/mmc_test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/mmc/core/mmc_test.c +2 -2
index 6cd6f8a94a71..156d34b2ed4d 100644
@@ -3174,7 +3174,8 @@ static int __mmc_test_register_dbgfs_file(struct mmc_card *card,
        struct mmc_test_dbgfs_file *df;
 
        if (card->debugfs_root)
-               debugfs_create_file(name, mode, card->debugfs_root, card, fops);
+               file = debugfs_create_file(name, mode, card->debugfs_root,
+                                          card, fops);
 
        df = kmalloc(sizeof(*df), GFP_KERNEL);
        if (!df) {
--

2.31.1