Skip to contentSkip to conversation

mei: Fix debugfs filename in error output

PATCH Superseded Tomas Winkler 2 participants 7 messages Sep 21, 2015 – Oct 25, 2015

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 mei: Fix debugfs filename in error output

From: Alexander Kuleshov <[email protected]>

---
V2: fixed author address

 drivers/misc/mei/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/debugfs.c +1 -1
index 4b469cf9e60f..c157f0ba575c 100644
@@ -213,7 +213,7 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name)
 	f = debugfs_create_file("active", S_IRUSR, dir,
 				dev, &mei_dbgfs_fops_active);
 	if (!f) {
-		dev_err(dev->dev, "meclients: registration failed\n");
+		dev_err(dev->dev, "active: registration failed\n");
 		goto err;
 	}
 	f = debugfs_create_file("devstate", S_IRUSR, dir,
Signature · 1 line
2.4.3
#1 lore raw
Quoted 15 lines · Tomas Winkler

From: Alexander Kuleshov <[email protected]>

---
V2: fixed author address

 drivers/misc/mei/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/debugfs.c +0 -0
index 4b469cf9e60f..c157f0ba575c 100644

drivers/misc/mei/debugfs.c int mei_dbgfs_register(struct mei_device *dev, const char *name) · line 217

Quoted 6 lines
drivers/misc/mei/debugfs.c +1 -1
@@ -213,7 +213,7 @@ int mei_dbgfs_register(struct mei_device *dev, const char *name)
 	f = debugfs_create_file("active", S_IRUSR, dir,
 				dev, &mei_dbgfs_fops_active);
 	if (!f) {
-		dev_err(dev->dev, "meclients: registration failed\n");
+		dev_err(dev->dev, "active: registration failed\n");
 		goto err;

You should never care if a debugfs call fails or not. Also, this will "fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

greg k-h

#2 lore raw
Quoted 18 lines · Tomas Winkler

drivers/misc/mei/debugfs.c int mei_dbgfs_register(struct mei_device *dev, const

Quoted 15 lines

From: Alexander Kuleshov <[email protected]>

---
V2: fixed author address

 drivers/misc/mei/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/debugfs.c +0 -0
index 4b469cf9e60f..c157f0ba575c 100644
@@ -213,7 +213,7 @@ int mei_dbgfs_register(struct mei_device *dev, const

char *name)

Quoted 8 lines

drivers/misc/mei/debugfs.c int mei_dbgfs_register(struct mei_device *dev, const char *name) · line 217

Quoted 6 lines
drivers/misc/mei/debugfs.c +1 -1
 	f = debugfs_create_file("active", S_IRUSR, dir,
 				dev, &mei_dbgfs_fops_active);
 	if (!f) {
-		dev_err(dev->dev, "meclients: registration failed\n");
+		dev_err(dev->dev, "active: registration failed\n");
 		goto err;

You should never care if a debugfs call fails or not.

The system should not be dependent on the debug feature but, it is always good to know if there our system is failing

Also, this will

Quoted 2 lines

"fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

The whole file is not compiled if CONFIG_DEBUGFS is not set, please see the Makefile

Thanks
Tomas

#3 lore raw
Quoted 27 lines · Tomas
Quoted 18 lines · Tomas Winkler

drivers/misc/mei/debugfs.c int mei_dbgfs_register(struct mei_device *dev, const

Quoted 15 lines

From: Alexander Kuleshov <[email protected]>

---
V2: fixed author address

 drivers/misc/mei/debugfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/mei/debugfs.c +0 -0
index 4b469cf9e60f..c157f0ba575c 100644
@@ -213,7 +213,7 @@ int mei_dbgfs_register(struct mei_device *dev, const

char *name)

Quoted 8 lines

drivers/misc/mei/debugfs.c int mei_dbgfs_register(struct mei_device *dev, const char *name) · line 217

Quoted 6 lines
drivers/misc/mei/debugfs.c +1 -1
 	f = debugfs_create_file("active", S_IRUSR, dir,
 				dev, &mei_dbgfs_fops_active);
 	if (!f) {
-		dev_err(dev->dev, "meclients: registration failed\n");
+		dev_err(dev->dev, "active: registration failed\n");
 		goto err;

You should never care if a debugfs call fails or not.

Quoted 2 lines

The system should not be dependent on the debug feature but, it is always good to know if there our system is failing

And what can you do if it is "failing"? Really nothing, so there's nothing to check here.

Quoted 5 lines

Also, this will

Quoted 2 lines

"fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

The whole file is not compiled if CONFIG_DEBUGFS is not set, please see the Makefile

Ok, then you don't need to check anything. Debugfs was created to be dirt-simple, don't add complexity and "must unwind cleanly" type logic here where it's not needed at all. That just hurts my sensibilities for why I made the API the way it is in the first place :)

thanks,

greg k-h

#4 lore raw
Quoted 9 lines
Quoted 6 lines
Quoted 3 lines
Quoted 1 line

goto err;

You should never care if a debugfs call fails or not.

The system should not be dependent on the debug feature but, it is always good to know if there our system is failing

And what can you do if it is "failing"? Really nothing, so there's nothing to check here.

As far as I can see the function debugfs_create_file may fail for a few reasons and it return NULL if this is happening. I might ignore the error as you suggested, but I'm not sure why not to give a hint in log that this happened. Second, as far as I scanned the kernel sources, checking the return value of this function and acting on this is very common.

Quoted 11 lines
Quoted 5 lines

Also, this will

Quoted 2 lines

"fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

The whole file is not compiled if CONFIG_DEBUGFS is not set, please see the

Makefile

Ok, then you don't need to check anything. Debugfs was created to be dirt-simple, don't add complexity and "must unwind cleanly" type logic here where it's not needed at all. That just hurts my sensibilities for why I made the API the way it is in the first place :)

I don't see the code much complex, it is pretty much boilerplate code and this is why this c&p error had happened. So this patch just fixes a c&p error in an error message and if we wish to change the behavior to match your vision I suggest to doing it another patch set... maybe even sweeping the whole kernel.

Thanks
Tomas

#5 lore raw
Quoted 30 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

goto err;

You should never care if a debugfs call fails or not.

The system should not be dependent on the debug feature but, it is always good to know if there our system is failing

And what can you do if it is "failing"? Really nothing, so there's nothing to check here.

As far as I can see the function debugfs_create_file may fail for a few reasons and it return NULL if this is happening.
I might ignore the error as you suggested, but I'm not sure why not to give a hint in log that this happened.
Second, as far as I scanned the kernel sources, checking the return value of this function and acting on this is very common.

Quoted 11 lines
Quoted 5 lines

Also, this will

Quoted 2 lines

"fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

The whole file is not compiled if CONFIG_DEBUGFS is not set, please see the

Makefile

Ok, then you don't need to check anything. Debugfs was created to be dirt-simple, don't add complexity and "must unwind cleanly" type logic here where it's not needed at all. That just hurts my sensibilities for why I made the API the way it is in the first place :)

Quoted 5 lines

I don't see the code much complex, it is pretty much boilerplate code and this is why this c&p error had happened.
So this patch just fixes a c&p error in an error message and if we wish to change the behavior to match your vision
I suggest to doing it another patch set... maybe even sweeping the whole kernel.

Greg, are you merging this patch? What is your final say?

Thanks
Tomas

#6 lore raw
Quoted 30 lines · Tomas
Quoted 30 lines
Quoted 10 lines
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

goto err;

You should never care if a debugfs call fails or not.

The system should not be dependent on the debug feature but, it is always good to know if there our system is failing

And what can you do if it is "failing"? Really nothing, so there's nothing to check here.

As far as I can see the function debugfs_create_file may fail for a few reasons and it return NULL if this is happening.
I might ignore the error as you suggested, but I'm not sure why not to give a hint in log that this happened.
Second, as far as I scanned the kernel sources, checking the return value of this function and acting on this is very common.

Quoted 11 lines
Quoted 5 lines

Also, this will

Quoted 2 lines

"fail" if you don't have CONFIG_DEBUGFS enabled, which means you are using the api wrong :(

The whole file is not compiled if CONFIG_DEBUGFS is not set, please see the

Makefile

Ok, then you don't need to check anything. Debugfs was created to be dirt-simple, don't add complexity and "must unwind cleanly" type logic here where it's not needed at all. That just hurts my sensibilities for why I made the API the way it is in the first place :)

Quoted 8 lines
Quoted 5 lines

I don't see the code much complex, it is pretty much boilerplate code and this is why this c&p error had happened.
So this patch just fixes a c&p error in an error message and if we wish to change the behavior to match your vision
I suggest to doing it another patch set... maybe even sweeping the whole kernel.

Greg, are you merging this patch? What is your final say?

It's no longer in my todo queue, so there's nothing for me to apply here, sorry.

Please resend it if you feel it should be added.

thanks,

greg k-h