diff options
author | Marcel Holtmann <marcel@holtmann.org> | 2013-10-17 20:24:16 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2013-10-18 03:45:19 -0400 |
commit | 1120e4bfa5f9c28cb55d815ab3c6bed81dfc595c (patch) | |
tree | 0a24ba3d546bf60ea51a022028f66747b0829996 /net/bluetooth | |
parent | 47219839b43dec0520ef1ec72122186b3aa3de97 (diff) |
Bluetooth: Use IS_ERR_OR_NULL for checking bt_debugfs
Make sure to use IS_ERR_OR_NULL for checking the existing of the root
debugfs dentry bt_debugfs.
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/l2cap_core.c | 11 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/core.c | 14 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/sock.c | 14 | ||||
-rw-r--r-- | net/bluetooth/sco.c | 13 |
4 files changed, 25 insertions, 27 deletions
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index 8af34d2fdbef..763b7417dab7 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -6833,12 +6833,11 @@ int __init l2cap_init(void) | |||
6833 | if (err < 0) | 6833 | if (err < 0) |
6834 | return err; | 6834 | return err; |
6835 | 6835 | ||
6836 | if (bt_debugfs) { | 6836 | if (IS_ERR_OR_NULL(bt_debugfs)) |
6837 | l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs, | 6837 | return 0; |
6838 | NULL, &l2cap_debugfs_fops); | 6838 | |
6839 | if (!l2cap_debugfs) | 6839 | l2cap_debugfs = debugfs_create_file("l2cap", 0444, bt_debugfs, |
6840 | BT_ERR("Failed to create L2CAP debug file"); | 6840 | NULL, &l2cap_debugfs_fops); |
6841 | } | ||
6842 | 6841 | ||
6843 | return 0; | 6842 | return 0; |
6844 | } | 6843 | } |
diff --git a/net/bluetooth/rfcomm/core.c b/net/bluetooth/rfcomm/core.c index 27e936a7ddd9..94d06cbfbc18 100644 --- a/net/bluetooth/rfcomm/core.c +++ b/net/bluetooth/rfcomm/core.c | |||
@@ -2154,13 +2154,6 @@ static int __init rfcomm_init(void) | |||
2154 | goto unregister; | 2154 | goto unregister; |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | if (bt_debugfs) { | ||
2158 | rfcomm_dlc_debugfs = debugfs_create_file("rfcomm_dlc", 0444, | ||
2159 | bt_debugfs, NULL, &rfcomm_dlc_debugfs_fops); | ||
2160 | if (!rfcomm_dlc_debugfs) | ||
2161 | BT_ERR("Failed to create RFCOMM debug file"); | ||
2162 | } | ||
2163 | |||
2164 | err = rfcomm_init_ttys(); | 2157 | err = rfcomm_init_ttys(); |
2165 | if (err < 0) | 2158 | if (err < 0) |
2166 | goto stop; | 2159 | goto stop; |
@@ -2171,6 +2164,13 @@ static int __init rfcomm_init(void) | |||
2171 | 2164 | ||
2172 | BT_INFO("RFCOMM ver %s", VERSION); | 2165 | BT_INFO("RFCOMM ver %s", VERSION); |
2173 | 2166 | ||
2167 | if (IS_ERR_OR_NULL(bt_debugfs)) | ||
2168 | return 0; | ||
2169 | |||
2170 | rfcomm_dlc_debugfs = debugfs_create_file("rfcomm_dlc", 0444, | ||
2171 | bt_debugfs, NULL, | ||
2172 | &rfcomm_dlc_debugfs_fops); | ||
2173 | |||
2174 | return 0; | 2174 | return 0; |
2175 | 2175 | ||
2176 | cleanup: | 2176 | cleanup: |
diff --git a/net/bluetooth/rfcomm/sock.c b/net/bluetooth/rfcomm/sock.c index df17276eb32b..c4d3d423f89b 100644 --- a/net/bluetooth/rfcomm/sock.c +++ b/net/bluetooth/rfcomm/sock.c | |||
@@ -1051,15 +1051,15 @@ int __init rfcomm_init_sockets(void) | |||
1051 | goto error; | 1051 | goto error; |
1052 | } | 1052 | } |
1053 | 1053 | ||
1054 | if (bt_debugfs) { | ||
1055 | rfcomm_sock_debugfs = debugfs_create_file("rfcomm", 0444, | ||
1056 | bt_debugfs, NULL, &rfcomm_sock_debugfs_fops); | ||
1057 | if (!rfcomm_sock_debugfs) | ||
1058 | BT_ERR("Failed to create RFCOMM debug file"); | ||
1059 | } | ||
1060 | |||
1061 | BT_INFO("RFCOMM socket layer initialized"); | 1054 | BT_INFO("RFCOMM socket layer initialized"); |
1062 | 1055 | ||
1056 | if (IS_ERR_OR_NULL(bt_debugfs)) | ||
1057 | return 0; | ||
1058 | |||
1059 | rfcomm_sock_debugfs = debugfs_create_file("rfcomm", 0444, | ||
1060 | bt_debugfs, NULL, | ||
1061 | &rfcomm_sock_debugfs_fops); | ||
1062 | |||
1063 | return 0; | 1063 | return 0; |
1064 | 1064 | ||
1065 | error: | 1065 | error: |
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c index a92aebac56ca..12a0e51e21e1 100644 --- a/net/bluetooth/sco.c +++ b/net/bluetooth/sco.c | |||
@@ -1177,15 +1177,14 @@ int __init sco_init(void) | |||
1177 | goto error; | 1177 | goto error; |
1178 | } | 1178 | } |
1179 | 1179 | ||
1180 | if (bt_debugfs) { | ||
1181 | sco_debugfs = debugfs_create_file("sco", 0444, bt_debugfs, | ||
1182 | NULL, &sco_debugfs_fops); | ||
1183 | if (!sco_debugfs) | ||
1184 | BT_ERR("Failed to create SCO debug file"); | ||
1185 | } | ||
1186 | |||
1187 | BT_INFO("SCO socket layer initialized"); | 1180 | BT_INFO("SCO socket layer initialized"); |
1188 | 1181 | ||
1182 | if (IS_ERR_OR_NULL(bt_debugfs)) | ||
1183 | return 0; | ||
1184 | |||
1185 | sco_debugfs = debugfs_create_file("sco", 0444, bt_debugfs, | ||
1186 | NULL, &sco_debugfs_fops); | ||
1187 | |||
1189 | return 0; | 1188 | return 0; |
1190 | 1189 | ||
1191 | error: | 1190 | error: |