From patchwork Tue May 29 15:30:46 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10436237 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 74C11601C7 for ; Tue, 29 May 2018 15:31:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 63F4428813 for ; Tue, 29 May 2018 15:31:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 57DC328893; Tue, 29 May 2018 15:31:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A7AC428813 for ; Tue, 29 May 2018 15:31:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935010AbeE2Pbj (ORCPT ); Tue, 29 May 2018 11:31:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:39676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934836AbeE2Pbj (ORCPT ); Tue, 29 May 2018 11:31:39 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id F1DF420899; Tue, 29 May 2018 15:31:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607898; bh=M9GJmFG3XhmazaJ7DXAt3NCgj3jRRVN/6hxT2zkkzBA=; h=From:To:Cc:Subject:Date:From; b=vyTPaMOCKMJl2uYLIGJtYL5hNmHheNQ3cldt6K062wqfQrRZIlJwvZJLWPwHJdoia CVcdzHRU2Mm6gJ5Anp0tr+Jq4ey44d7XxV4u02tDd/Pf67SS4bj6jUO8uL4NOs9Hsh XVJEA9BgCFcouA5IxmWhqY6G3YMZLJbbIRuWWocs= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Heikki Krogerus Subject: [PATCH 01/22] USB: typec: tcpm: no need to check return value of debugfs_create_dir() Date: Tue, 29 May 2018 17:30:46 +0200 Message-Id: <20180529153107.12791-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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... Cc: Heikki Krogerus Signed-off-by: Greg Kroah-Hartman Reviewed-by: Guenter Roeck --- drivers/usb/typec/tcpm.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 0ccd2ce1eb59..8a201dd53d36 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -566,21 +566,16 @@ DEFINE_SHOW_ATTRIBUTE(tcpm_debug); static struct dentry *rootdir; -static int tcpm_debugfs_init(struct tcpm_port *port) +static void tcpm_debugfs_init(struct tcpm_port *port) { mutex_init(&port->logbuffer_lock); /* /sys/kernel/debug/tcpm/usbcX */ - if (!rootdir) { + if (!rootdir) rootdir = debugfs_create_dir("tcpm", NULL); - if (!rootdir) - return -ENOMEM; - } port->dentry = debugfs_create_file(dev_name(port->dev), S_IFREG | 0444, rootdir, port, &tcpm_debug_fops); - - return 0; } static void tcpm_debugfs_exit(struct tcpm_port *port) @@ -595,7 +590,7 @@ static void tcpm_log(const struct tcpm_port *port, const char *fmt, ...) { } __printf(2, 3) static void tcpm_log_force(struct tcpm_port *port, const char *fmt, ...) { } static void tcpm_log_source_caps(struct tcpm_port *port) { } -static int tcpm_debugfs_init(const struct tcpm_port *port) { return 0; } +static void tcpm_debugfs_init(const struct tcpm_port *port) { } static void tcpm_debugfs_exit(const struct tcpm_port *port) { } #endif