From patchwork Tue May 29 15:30:55 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: 10436277 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 3A7DE601C7 for ; Tue, 29 May 2018 15:32:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2961228889 for ; Tue, 29 May 2018 15:32:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1E31B288B2; Tue, 29 May 2018 15:32:46 +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 8B51B28889 for ; Tue, 29 May 2018 15:32:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935630AbeE2Pco (ORCPT ); Tue, 29 May 2018 11:32:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:40266 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934963AbeE2Pcn (ORCPT ); Tue, 29 May 2018 11:32:43 -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 60DAE20899; Tue, 29 May 2018 15:32:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607962; bh=Rbv9TuSL9/70gp0Ibu+zR4M+F37nnfwlCcR4gU55BqI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lgy8fYnQ9MDf+gAUJtnOBnJjb3sk8A9w8n3hS6ZVKR8yLPppQAr03ni2lo6sL8jYV 3hVbJOkOJGaP4fHPaGFcRh5Ye1h/NxR6/7DygO57Gm3VFu+lzpnKoM3U+1Lgzundu5 jlvYQtKasKfLcqMbWOlDhOY+/7BpRjC2SKKUlJfg= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Felipe Balbi , Alan Stern , Johan Hovold , Kuppuswamy Sathyanarayanan , Vasyl Gomonovych , Mariusz Skamra , "Gustavo A. R. Silva" Subject: [PATCH 10/22] USB: fotg210-hcd: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:30:55 +0200 Message-Id: <20180529153107.12791-10-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. Cc: Felipe Balbi Cc: Alan Stern Cc: Johan Hovold Cc: Kuppuswamy Sathyanarayanan Cc: Vasyl Gomonovych Cc: Mariusz Skamra Cc: "Gustavo A. R. Silva" Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/fotg210-hcd.c | 34 +++++++++------------------------- 1 file changed, 9 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/fotg210-hcd.c b/drivers/usb/host/fotg210-hcd.c index d8abf401918a..e64eb47770c8 100644 --- a/drivers/usb/host/fotg210-hcd.c +++ b/drivers/usb/host/fotg210-hcd.c @@ -844,28 +844,16 @@ static int debug_registers_open(struct inode *inode, struct file *file) static inline void create_debug_files(struct fotg210_hcd *fotg210) { struct usb_bus *bus = &fotg210_to_hcd(fotg210)->self; + struct dentry *root; - fotg210->debug_dir = debugfs_create_dir(bus->bus_name, - fotg210_debug_root); - if (!fotg210->debug_dir) - return; - - if (!debugfs_create_file("async", S_IRUGO, fotg210->debug_dir, bus, - &debug_async_fops)) - goto file_error; - - if (!debugfs_create_file("periodic", S_IRUGO, fotg210->debug_dir, bus, - &debug_periodic_fops)) - goto file_error; + root = debugfs_create_dir(bus->bus_name, fotg210_debug_root); + fotg210->debug_dir = root; - if (!debugfs_create_file("registers", S_IRUGO, fotg210->debug_dir, bus, - &debug_registers_fops)) - goto file_error; - - return; - -file_error: - debugfs_remove_recursive(fotg210->debug_dir); + debugfs_create_file("async", S_IRUGO, root, bus, &debug_async_fops); + debugfs_create_file("periodic", S_IRUGO, root, bus, + &debug_periodic_fops); + debugfs_create_file("registers", S_IRUGO, root, bus, + &debug_registers_fops); } static inline void remove_debug_files(struct fotg210_hcd *fotg210) @@ -5686,10 +5674,6 @@ static int __init fotg210_hcd_init(void) sizeof(struct fotg210_itd)); fotg210_debug_root = debugfs_create_dir("fotg210", usb_debug_root); - if (!fotg210_debug_root) { - retval = -ENOENT; - goto err_debug; - } retval = platform_driver_register(&fotg210_hcd_driver); if (retval < 0) @@ -5699,7 +5683,7 @@ static int __init fotg210_hcd_init(void) clean: debugfs_remove(fotg210_debug_root); fotg210_debug_root = NULL; -err_debug: + clear_bit(USB_EHCI_LOADED, &usb_hcds_loaded); return retval; }