Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

s390/dasd: Remove unnecessary debugfs_create() return checks

The DASD driver only uses the dentry pointers when removing debugfs
entries, and debugfs_remove() can safely handle both NULL and ERR_PTR.
There is therefore no need to check debugfs_create() return values.

This simplifies the debugfs setup code without changing functionality.

Suggested-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Stefan Haberland and committed by
Jens Axboe
764def9e c943bfc6

+8 -56
+8 -56
drivers/s390/block/dasd.c
··· 207 207 return 0; 208 208 } 209 209 210 - static struct dentry *dasd_debugfs_setup(const char *name, 211 - struct dentry *base_dentry) 212 - { 213 - struct dentry *pde; 214 - 215 - if (!base_dentry) 216 - return NULL; 217 - pde = debugfs_create_dir(name, base_dentry); 218 - if (!pde || IS_ERR(pde)) 219 - return NULL; 220 - return pde; 221 - } 222 - 223 210 /* 224 211 * Request the irq line for the device. 225 212 */ ··· 221 234 if (rc) 222 235 return rc; 223 236 block->debugfs_dentry = 224 - dasd_debugfs_setup(block->gdp->disk_name, 237 + debugfs_create_dir(block->gdp->disk_name, 225 238 dasd_debugfs_root_entry); 226 239 dasd_profile_init(&block->profile, block->debugfs_dentry); 227 240 if (dasd_global_profile_level == DASD_PROFILE_ON) 228 241 dasd_profile_on(&device->block->profile); 229 242 } 230 243 device->debugfs_dentry = 231 - dasd_debugfs_setup(dev_name(&device->cdev->dev), 244 + debugfs_create_dir(dev_name(&device->cdev->dev), 232 245 dasd_debugfs_root_entry); 233 246 dasd_profile_init(&device->profile, device->debugfs_dentry); 234 247 dasd_hosts_init(device->debugfs_dentry, device); ··· 1045 1058 static void dasd_profile_init(struct dasd_profile *profile, 1046 1059 struct dentry *base_dentry) 1047 1060 { 1048 - umode_t mode; 1049 - struct dentry *pde; 1050 - 1051 - if (!base_dentry) 1052 - return; 1053 - profile->dentry = NULL; 1054 1061 profile->data = NULL; 1055 - mode = (S_IRUSR | S_IWUSR | S_IFREG); 1056 - pde = debugfs_create_file("statistics", mode, base_dentry, 1057 - profile, &dasd_stats_raw_fops); 1058 - if (pde && !IS_ERR(pde)) 1059 - profile->dentry = pde; 1060 - return; 1062 + profile->dentry = debugfs_create_file("statistics", 0600, base_dentry, 1063 + profile, &dasd_stats_raw_fops); 1061 1064 } 1062 1065 1063 1066 static void dasd_profile_exit(struct dasd_profile *profile) ··· 1067 1090 1068 1091 static void dasd_statistics_createroot(void) 1069 1092 { 1070 - struct dentry *pde; 1071 - 1072 - dasd_debugfs_root_entry = NULL; 1073 - pde = debugfs_create_dir("dasd", NULL); 1074 - if (!pde || IS_ERR(pde)) 1075 - goto error; 1076 - dasd_debugfs_root_entry = pde; 1077 - pde = debugfs_create_dir("global", dasd_debugfs_root_entry); 1078 - if (!pde || IS_ERR(pde)) 1079 - goto error; 1080 - dasd_debugfs_global_entry = pde; 1093 + dasd_debugfs_root_entry = debugfs_create_dir("dasd", NULL); 1094 + dasd_debugfs_global_entry = debugfs_create_dir("global", dasd_debugfs_root_entry); 1081 1095 dasd_profile_init(&dasd_global_profile, dasd_debugfs_global_entry); 1082 - return; 1083 - 1084 - error: 1085 - DBF_EVENT(DBF_ERR, "%s", 1086 - "Creation of the dasd debugfs interface failed"); 1087 - dasd_statistics_removeroot(); 1088 - return; 1089 1096 } 1090 1097 1091 1098 #else ··· 1130 1169 static void dasd_hosts_init(struct dentry *base_dentry, 1131 1170 struct dasd_device *device) 1132 1171 { 1133 - struct dentry *pde; 1134 - umode_t mode; 1135 - 1136 - if (!base_dentry) 1137 - return; 1138 - 1139 - mode = S_IRUSR | S_IFREG; 1140 - pde = debugfs_create_file("host_access_list", mode, base_dentry, 1141 - device, &dasd_hosts_fops); 1142 - if (pde && !IS_ERR(pde)) 1143 - device->hosts_dentry = pde; 1172 + device->hosts_dentry = debugfs_create_file("host_access_list", 0400, base_dentry, 1173 + device, &dasd_hosts_fops); 1144 1174 } 1145 1175 1146 1176 struct dasd_ccw_req *dasd_smalloc_request(int magic, int cplength, int datasize,