aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-04-08 11:05:38 -0400
committerEnric Balletbo i Serra <enric.balletbo@collabora.com>2019-04-15 06:11:35 -0400
commitb18e606ff313e20e72b4a53cdddc16f476f2a740 (patch)
tree04e65491d75a7f811b0da5274b8007bb21e3e5d6 /drivers
parente43c426a777eb2554d8a29d31311debe897badd9 (diff)
platform/chrome: cros_ec_debugfs: no need to check return value of debugfs_create functions
When calling debugfs functions, there is no need to ever check the return value. The function can work or not, but the code logic should never do something different based on this. Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Enric Balletbo i Serra <enric.balletbo@collabora.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/platform/chrome/cros_ec_debugfs.c35
1 files changed, 6 insertions, 29 deletions
diff --git a/drivers/platform/chrome/cros_ec_debugfs.c b/drivers/platform/chrome/cros_ec_debugfs.c
index f0de1991b688..a712508e4646 100644
--- a/drivers/platform/chrome/cros_ec_debugfs.c
+++ b/drivers/platform/chrome/cros_ec_debugfs.c
@@ -337,12 +337,8 @@ static int cros_ec_create_console_log(struct cros_ec_debugfs *debug_info)
337 mutex_init(&debug_info->log_mutex); 337 mutex_init(&debug_info->log_mutex);
338 init_waitqueue_head(&debug_info->log_wq); 338 init_waitqueue_head(&debug_info->log_wq);
339 339
340 if (!debugfs_create_file("console_log", 340 debugfs_create_file("console_log", S_IFREG | 0444, debug_info->dir,
341 S_IFREG | 0444, 341 debug_info, &cros_ec_console_log_fops);
342 debug_info->dir,
343 debug_info,
344 &cros_ec_console_log_fops))
345 return -ENOMEM;
346 342
347 INIT_DELAYED_WORK(&debug_info->log_poll_work, 343 INIT_DELAYED_WORK(&debug_info->log_poll_work,
348 cros_ec_console_log_work); 344 cros_ec_console_log_work);
@@ -390,13 +386,8 @@ static int cros_ec_create_panicinfo(struct cros_ec_debugfs *debug_info)
390 debug_info->panicinfo_blob.data = msg->data; 386 debug_info->panicinfo_blob.data = msg->data;
391 debug_info->panicinfo_blob.size = ret; 387 debug_info->panicinfo_blob.size = ret;
392 388
393 if (!debugfs_create_blob("panicinfo", 389 debugfs_create_blob("panicinfo", S_IFREG | 0444, debug_info->dir,
394 S_IFREG | 0444, 390 &debug_info->panicinfo_blob);
395 debug_info->dir,
396 &debug_info->panicinfo_blob)) {
397 ret = -ENOMEM;
398 goto free;
399 }
400 391
401 return 0; 392 return 0;
402 393
@@ -405,15 +396,6 @@ free:
405 return ret; 396 return ret;
406} 397}
407 398
408static int cros_ec_create_pdinfo(struct cros_ec_debugfs *debug_info)
409{
410 if (!debugfs_create_file("pdinfo", 0444, debug_info->dir, debug_info,
411 &cros_ec_pdinfo_fops))
412 return -ENOMEM;
413
414 return 0;
415}
416
417static int cros_ec_debugfs_probe(struct platform_device *pd) 399static int cros_ec_debugfs_probe(struct platform_device *pd)
418{ 400{
419 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent); 401 struct cros_ec_dev *ec = dev_get_drvdata(pd->dev.parent);
@@ -428,8 +410,6 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
428 410
429 debug_info->ec = ec; 411 debug_info->ec = ec;
430 debug_info->dir = debugfs_create_dir(name, NULL); 412 debug_info->dir = debugfs_create_dir(name, NULL);
431 if (!debug_info->dir)
432 return -ENOMEM;
433 413
434 ret = cros_ec_create_panicinfo(debug_info); 414 ret = cros_ec_create_panicinfo(debug_info);
435 if (ret) 415 if (ret)
@@ -439,9 +419,8 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
439 if (ret) 419 if (ret)
440 goto remove_debugfs; 420 goto remove_debugfs;
441 421
442 ret = cros_ec_create_pdinfo(debug_info); 422 debugfs_create_file("pdinfo", 0444, debug_info->dir, debug_info,
443 if (ret) 423 &cros_ec_pdinfo_fops);
444 goto remove_log;
445 424
446 ec->debug_info = debug_info; 425 ec->debug_info = debug_info;
447 426
@@ -449,8 +428,6 @@ static int cros_ec_debugfs_probe(struct platform_device *pd)
449 428
450 return 0; 429 return 0;
451 430
452remove_log:
453 cros_ec_cleanup_console_log(debug_info);
454remove_debugfs: 431remove_debugfs:
455 debugfs_remove_recursive(debug_info->dir); 432 debugfs_remove_recursive(debug_info->dir);
456 return ret; 433 return ret;