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.

hypfs: switch hypfs_create_str() to returning int

Every single caller only cares about PTR_ERR_OR_ZERO() of return value...

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Al Viro 63f76f51 781716cd

+18 -40
+1 -2
arch/s390/hypfs/hypfs.h
··· 25 25 extern struct dentry *hypfs_create_u64(struct dentry *dir, const char *name, 26 26 __u64 value); 27 27 28 - extern struct dentry *hypfs_create_str(struct dentry *dir, const char *name, 29 - char *string); 28 + extern int hypfs_create_str(struct dentry *dir, const char *name, char *string); 30 29 31 30 /* LPAR Hypervisor */ 32 31 extern int hypfs_diag_init(void);
+11 -29
arch/s390/hypfs/hypfs_diag_fs.c
··· 228 228 return PTR_ERR(rc); 229 229 } 230 230 diag224_idx2name(cpu_info__ctidx(diag204_get_info_type(), cpu_info), buffer); 231 - rc = hypfs_create_str(cpu_dir, "type", buffer); 232 - return PTR_ERR_OR_ZERO(rc); 231 + return hypfs_create_str(cpu_dir, "type", buffer); 233 232 } 234 233 235 234 static void *hypfs_create_lpar_files(struct dentry *systems_dir, void *part_hdr) ··· 275 276 if (IS_ERR(rc)) 276 277 return PTR_ERR(rc); 277 278 diag224_idx2name(phys_cpu__ctidx(diag204_get_info_type(), cpu_info), buffer); 278 - rc = hypfs_create_str(cpu_dir, "type", buffer); 279 - return PTR_ERR_OR_ZERO(rc); 279 + return hypfs_create_str(cpu_dir, "type", buffer); 280 280 } 281 281 282 282 static void *hypfs_create_phys_files(struct dentry *parent_dir, void *phys_hdr) ··· 314 316 return rc; 315 317 316 318 systems_dir = hypfs_mkdir(root, "systems"); 317 - if (IS_ERR(systems_dir)) { 318 - rc = PTR_ERR(systems_dir); 319 - goto err_out; 320 - } 319 + if (IS_ERR(systems_dir)) 320 + return PTR_ERR(systems_dir); 321 321 time_hdr = (struct x_info_blk_hdr *)buffer; 322 322 part_hdr = time_hdr + info_blk_hdr__size(diag204_get_info_type()); 323 323 for (i = 0; i < info_blk_hdr__npar(diag204_get_info_type(), time_hdr); i++) { 324 324 part_hdr = hypfs_create_lpar_files(systems_dir, part_hdr); 325 - if (IS_ERR(part_hdr)) { 326 - rc = PTR_ERR(part_hdr); 327 - goto err_out; 328 - } 325 + if (IS_ERR(part_hdr)) 326 + return PTR_ERR(part_hdr); 329 327 } 330 328 if (info_blk_hdr__flags(diag204_get_info_type(), time_hdr) & 331 329 DIAG204_LPAR_PHYS_FLG) { 332 330 ptr = hypfs_create_phys_files(root, part_hdr); 333 - if (IS_ERR(ptr)) { 334 - rc = PTR_ERR(ptr); 335 - goto err_out; 336 - } 331 + if (IS_ERR(ptr)) 332 + return PTR_ERR(ptr); 337 333 } 338 334 hyp_dir = hypfs_mkdir(root, "hyp"); 339 - if (IS_ERR(hyp_dir)) { 340 - rc = PTR_ERR(hyp_dir); 341 - goto err_out; 342 - } 343 - ptr = hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor"); 344 - if (IS_ERR(ptr)) { 345 - rc = PTR_ERR(ptr); 346 - goto err_out; 347 - } 348 - rc = 0; 349 - 350 - err_out: 351 - return rc; 335 + if (IS_ERR(hyp_dir)) 336 + return PTR_ERR(hyp_dir); 337 + return hypfs_create_str(hyp_dir, "type", "LPAR Hypervisor"); 352 338 } 353 339 354 340 /* Diagnose 224 functions */
+2 -4
arch/s390/hypfs/hypfs_vm_fs.c
··· 100 100 rc = PTR_ERR(dir); 101 101 goto failed; 102 102 } 103 - file = hypfs_create_str(dir, "type", "z/VM Hypervisor"); 104 - if (IS_ERR(file)) { 105 - rc = PTR_ERR(file); 103 + rc = hypfs_create_str(dir, "type", "z/VM Hypervisor"); 104 + if (rc) 106 105 goto failed; 107 - } 108 106 109 107 /* physical cpus */ 110 108 dir = hypfs_mkdir(root, "cpus");
+4 -5
arch/s390/hypfs/inode.c
··· 398 398 return dentry; 399 399 } 400 400 401 - struct dentry *hypfs_create_str(struct dentry *dir, 402 - const char *name, char *string) 401 + int hypfs_create_str(struct dentry *dir, const char *name, char *string) 403 402 { 404 403 char *buffer; 405 404 struct dentry *dentry; 406 405 407 406 buffer = kmalloc(strlen(string) + 2, GFP_KERNEL); 408 407 if (!buffer) 409 - return ERR_PTR(-ENOMEM); 408 + return -ENOMEM; 410 409 sprintf(buffer, "%s\n", string); 411 410 dentry = 412 411 hypfs_create_file(dir, name, buffer, S_IFREG | REG_FILE_MODE); 413 412 if (IS_ERR(dentry)) { 414 413 kfree(buffer); 415 - return ERR_PTR(-ENOMEM); 414 + return -ENOMEM; 416 415 } 417 416 hypfs_add_dentry(dentry); 418 - return dentry; 417 + return 0; 419 418 } 420 419 421 420 static const struct file_operations hypfs_file_ops = {