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

USB: typec: tcpm: no need to check return value of debugfs_create_dir()

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.

Clean up the tcpm.c code to not care about this, turns out no one was
even checking the return value of this function, so it didn't matter.

Note, I do not think this code can be removed in a running system, as
the debugfs root directory will stick around, that should be fixed
someday...

Revieved-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+3 -8
+3 -8
drivers/usb/typec/tcpm.c
··· 566 566 567 567 static struct dentry *rootdir; 568 568 569 - static int tcpm_debugfs_init(struct tcpm_port *port) 569 + static void tcpm_debugfs_init(struct tcpm_port *port) 570 570 { 571 571 mutex_init(&port->logbuffer_lock); 572 572 /* /sys/kernel/debug/tcpm/usbcX */ 573 - if (!rootdir) { 573 + if (!rootdir) 574 574 rootdir = debugfs_create_dir("tcpm", NULL); 575 - if (!rootdir) 576 - return -ENOMEM; 577 - } 578 575 579 576 port->dentry = debugfs_create_file(dev_name(port->dev), 580 577 S_IFREG | 0444, rootdir, 581 578 port, &tcpm_debug_fops); 582 - 583 - return 0; 584 579 } 585 580 586 581 static void tcpm_debugfs_exit(struct tcpm_port *port) ··· 590 595 __printf(2, 3) 591 596 static void tcpm_log_force(struct tcpm_port *port, const char *fmt, ...) { } 592 597 static void tcpm_log_source_caps(struct tcpm_port *port) { } 593 - static int tcpm_debugfs_init(const struct tcpm_port *port) { return 0; } 598 + static void tcpm_debugfs_init(const struct tcpm_port *port) { } 594 599 static void tcpm_debugfs_exit(const struct tcpm_port *port) { } 595 600 596 601 #endif