From patchwork Tue May 29 15:31:03 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: 10436251 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 DB591602BF for ; Tue, 29 May 2018 15:32:14 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC312868F for ; Tue, 29 May 2018 15:32:14 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE24D28889; Tue, 29 May 2018 15:32:14 +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 60E432868F for ; Tue, 29 May 2018 15:32:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935383AbeE2PcL (ORCPT ); Tue, 29 May 2018 11:32:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:39926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935435AbeE2PcJ (ORCPT ); Tue, 29 May 2018 11:32:09 -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 231F6208A0; Tue, 29 May 2018 15:32:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607928; bh=Xa8JpLgbeKVhtMgtedEUBx5xliOR9BPzfeXU4PU+HEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qTtBmhxLHpmb0FyJeaIlM+jBbhEfiihJsSGI7GantCIt8FWGNIJSXk5OrfuBjhuFM UN6CJ/lFKs334B8G8Qc25GUR2ab9NHqdtes+S1fNuYBcaxamscswrAanJ60RNBcYTI DS+L0WsV4GLpEhEc+I9GNg1R/grreylElVDo6A8E= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Kevin Cernekee , Felipe Balbi , Florian Fainelli Subject: [PATCH 18/22] USB: gadget: udc: bcm63xx_udc: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:31:03 +0200 Message-Id: <20180529153107.12791-18-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 device structure. Cc: Kevin Cernekee Cc: Felipe Balbi Cc: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/bcm63xx_udc.c | 37 ++++------------------------ 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/drivers/usb/gadget/udc/bcm63xx_udc.c b/drivers/usb/gadget/udc/bcm63xx_udc.c index 3a8df8601074..c1fcc77403ea 100644 --- a/drivers/usb/gadget/udc/bcm63xx_udc.c +++ b/drivers/usb/gadget/udc/bcm63xx_udc.c @@ -288,8 +288,6 @@ struct bcm63xx_req { * @ep0_reply: Pending reply from gadget driver. * @ep0_request: Outstanding ep0 request. * @debugfs_root: debugfs directory: /sys/kernel/debug/. - * @debugfs_usbd: debugfs file "usbd" for controller state. - * @debugfs_iudma: debugfs file "usbd" for IUDMA state. */ struct bcm63xx_udc { spinlock_t lock; @@ -330,8 +328,6 @@ struct bcm63xx_udc { struct usb_request *ep0_request; struct dentry *debugfs_root; - struct dentry *debugfs_usbd; - struct dentry *debugfs_iudma; }; static const struct usb_ep_ops bcm63xx_udc_ep_ops; @@ -2247,34 +2243,16 @@ DEFINE_SHOW_ATTRIBUTE(bcm63xx_iudma_dbg); */ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) { - struct dentry *root, *usbd, *iudma; + struct dentry *root; if (!IS_ENABLED(CONFIG_USB_GADGET_DEBUG_FS)) return; root = debugfs_create_dir(udc->gadget.name, NULL); - if (IS_ERR(root) || !root) - goto err_root; - - usbd = debugfs_create_file("usbd", 0400, root, udc, - &bcm63xx_usbd_dbg_fops); - if (!usbd) - goto err_usbd; - iudma = debugfs_create_file("iudma", 0400, root, udc, - &bcm63xx_iudma_dbg_fops); - if (!iudma) - goto err_iudma; - udc->debugfs_root = root; - udc->debugfs_usbd = usbd; - udc->debugfs_iudma = iudma; - return; -err_iudma: - debugfs_remove(usbd); -err_usbd: - debugfs_remove(root); -err_root: - dev_err(udc->dev, "debugfs is not available\n"); + + debugfs_create_file("usbd", 0400, root, udc, &bcm63xx_usbd_dbg_fops); + debugfs_create_file("iudma", 0400, root, udc, &bcm63xx_iudma_dbg_fops); } /** @@ -2285,12 +2263,7 @@ static void bcm63xx_udc_init_debugfs(struct bcm63xx_udc *udc) */ static void bcm63xx_udc_cleanup_debugfs(struct bcm63xx_udc *udc) { - debugfs_remove(udc->debugfs_iudma); - debugfs_remove(udc->debugfs_usbd); - debugfs_remove(udc->debugfs_root); - udc->debugfs_iudma = NULL; - udc->debugfs_usbd = NULL; - udc->debugfs_root = NULL; + debugfs_remove_recursive(udc->debugfs_root); } /***********************************************************************