From patchwork Tue May 29 15:30:52 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: 10436271 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 BD914602BF for ; Tue, 29 May 2018 15:32:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ADE3228889 for ; Tue, 29 May 2018 15:32:37 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A29322889C; Tue, 29 May 2018 15:32:37 +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 3528F28889 for ; Tue, 29 May 2018 15:32:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935579AbeE2Pcf (ORCPT ); Tue, 29 May 2018 11:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:40190 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934963AbeE2Pce (ORCPT ); Tue, 29 May 2018 11:32:34 -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 F133E20899; Tue, 29 May 2018 15:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607954; bh=Lwf1FCksAi2oVBPfL1hEhB6qmDG39RwI4sJJ5IvLYBc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gERoN7KN4FsjE6L2H2Z6Khm6g38XLwmZqqMWbBobuG9wh4P1aDICNXolqVDlLujzy /P7G8zd56GS/OeGbwJi1TC8o21wUBwKZ4UhNGVjw5IEYHW8ncTOtobFRt70qjn2H+f 3eJQWAwMyjyOhkhXJ9p2ux6JE9yvTRaXcK4V4RuM= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Alan Stern Subject: [PATCH 07/22] USB: ohci: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:30:52 +0200 Message-Id: <20180529153107.12791-7-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180529153107.12791-1-gregkh@linuxfoundation.org> References: <20180529153107.12791-1-gregkh@linuxfoundation.org> 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. There is also no need to keep the file dentries around at all, so remove those variables from the host controller structure. Cc: Alan Stern Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/ohci-dbg.c | 45 ++++++++----------------------------- drivers/usb/host/ohci-hcd.c | 5 ----- drivers/usb/host/ohci.h | 3 --- 3 files changed, 9 insertions(+), 44 deletions(-) diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c index ac7d4ac34b02..d3ee1f52aaab 100644 --- a/drivers/usb/host/ohci-dbg.c +++ b/drivers/usb/host/ohci-dbg.c @@ -762,50 +762,23 @@ static int debug_registers_open(struct inode *inode, struct file *file) static inline void create_debug_files (struct ohci_hcd *ohci) { struct usb_bus *bus = &ohci_to_hcd(ohci)->self; + struct dentry *root; - ohci->debug_dir = debugfs_create_dir(bus->bus_name, ohci_debug_root); - if (!ohci->debug_dir) - goto dir_error; + root = debugfs_create_dir(bus->bus_name, ohci_debug_root); + ohci->debug_dir = root; - ohci->debug_async = debugfs_create_file("async", S_IRUGO, - ohci->debug_dir, ohci, - &debug_async_fops); - if (!ohci->debug_async) - goto async_error; - - ohci->debug_periodic = debugfs_create_file("periodic", S_IRUGO, - ohci->debug_dir, ohci, - &debug_periodic_fops); - if (!ohci->debug_periodic) - goto periodic_error; - - ohci->debug_registers = debugfs_create_file("registers", S_IRUGO, - ohci->debug_dir, ohci, - &debug_registers_fops); - if (!ohci->debug_registers) - goto registers_error; + debugfs_create_file("async", S_IRUGO, root, ohci, &debug_async_fops); + debugfs_create_file("periodic", S_IRUGO, root, ohci, + &debug_periodic_fops); + debugfs_create_file("registers", S_IRUGO, root, ohci, + &debug_registers_fops); ohci_dbg (ohci, "created debug files\n"); - return; - -registers_error: - debugfs_remove(ohci->debug_periodic); -periodic_error: - debugfs_remove(ohci->debug_async); -async_error: - debugfs_remove(ohci->debug_dir); -dir_error: - ohci->debug_periodic = NULL; - ohci->debug_async = NULL; - ohci->debug_dir = NULL; } static inline void remove_debug_files (struct ohci_hcd *ohci) { - debugfs_remove(ohci->debug_registers); - debugfs_remove(ohci->debug_periodic); - debugfs_remove(ohci->debug_async); - debugfs_remove(ohci->debug_dir); + debugfs_remove_recursive(ohci->debug_dir); } /*-------------------------------------------------------------------------*/ diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 4806e0f9e8d4..210181fd98d2 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c @@ -1258,10 +1258,6 @@ static int __init ohci_hcd_mod_init(void) set_bit(USB_OHCI_LOADED, &usb_hcds_loaded); ohci_debug_root = debugfs_create_dir("ohci", usb_debug_root); - if (!ohci_debug_root) { - retval = -ENOENT; - goto error_debug; - } #ifdef PS3_SYSTEM_BUS_DRIVER retval = ps3_ohci_driver_register(&PS3_SYSTEM_BUS_DRIVER); @@ -1318,7 +1314,6 @@ static int __init ohci_hcd_mod_init(void) #endif debugfs_remove(ohci_debug_root); ohci_debug_root = NULL; - error_debug: clear_bit(USB_OHCI_LOADED, &usb_hcds_loaded); return retval; diff --git a/drivers/usb/host/ohci.h b/drivers/usb/host/ohci.h index 508a803139dd..ef4813bfc5bf 100644 --- a/drivers/usb/host/ohci.h +++ b/drivers/usb/host/ohci.h @@ -431,9 +431,6 @@ struct ohci_hcd { struct work_struct nec_work; /* Worker for NEC quirk */ struct dentry *debug_dir; - struct dentry *debug_async; - struct dentry *debug_periodic; - struct dentry *debug_registers; /* platform-specific data -- must come last */ unsigned long priv[0] __aligned(sizeof(s64));