Bluetooth: 6lowpan: Fix debugfs_simple_attr.cocci warnings

This change “Bluetooth: 6lowpan: Fix debugfs_simple_attr.cocci warnings” in Linux kernel is authored by YueHaibing <yuehaibing [at]> on Wed Jan 16 01:54:06 2019 +0000.

Bluetooth: 6lowpan: Fix debugfs_simple_attr.cocci warnings

for debugfs files.

Semantic patch information:
Rationale: DEFINE_SIMPLE_ATTRIBUTE + debugfs_create_file()
imposes some significant overhead as compared to
DEFINE_DEBUGFS_ATTRIBUTE + debugfs_create_file_unsafe().

Generated by: scripts/coccinelle/api/debugfs/debugfs_simple_attr.cocci

Signed-off-by: YueHaibing <>
Signed-off-by: Marcel Holtmann <>

This Linux change may have been applied to various maintained Linux releases and you can find Linux releases including commit e250fab.

There are 11 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 net/bluetooth/6lowpan.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/net/bluetooth/6lowpan.c b/net/bluetooth/6lowpan.c
index 9d79c7d..a7cd23f0 100644
--- a/net/bluetooth/6lowpan.c
+++ b/net/bluetooth/6lowpan.c
@@ -1108,8 +1108,8 @@ static int lowpan_enable_get(void *data, u64 *val)
 	return 0;
-DEFINE_SIMPLE_ATTRIBUTE(lowpan_enable_fops, lowpan_enable_get,
-			lowpan_enable_set, "%llun");
+DEFINE_DEBUGFS_ATTRIBUTE(lowpan_enable_fops, lowpan_enable_get,
+			 lowpan_enable_set, "%llun");
 static ssize_t lowpan_control_write(struct file *fp,
 				    const char __user *user_buffer,
@@ -1278,9 +1278,10 @@ static int device_event(struct notifier_block *unused,
 static int __init bt_6lowpan_init(void)
-	lowpan_enable_debugfs = debugfs_create_file("6lowpan_enable", 0644,
-						    bt_debugfs, NULL,
-						    &lowpan_enable_fops);
+	lowpan_enable_debugfs = debugfs_create_file_unsafe("6lowpan_enable",
+							   0644, bt_debugfs,
+							   NULL,
+							   &lowpan_enable_fops);
 	lowpan_control_debugfs = debugfs_create_file("6lowpan_control", 0644,
 						     bt_debugfs, NULL,

The commit for this change in Linux stable tree is e250fab (patch).

Leave a Reply

Your email address will not be published. Required fields are marked *