From patchwork Tue May 29 15:31:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10436257 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 013E1602BF for ; Tue, 29 May 2018 15:32:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6D9A2868F for ; Tue, 29 May 2018 15:32:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DBBC628889; Tue, 29 May 2018 15:32:18 +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 4A8C62868F for ; Tue, 29 May 2018 15:32:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935537AbeE2PcQ (ORCPT ); Tue, 29 May 2018 11:32:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:39996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935521AbeE2PcP (ORCPT ); Tue, 29 May 2018 11:32:15 -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 24560208A0; Tue, 29 May 2018 15:32:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607934; bh=5Rg3/8Y9PFr6SXsuI8f/rzzdTKOQe/UYT+NTKUs0bSs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=InNeGvjpNEEdLa8CcBQp64YZc9fNG+3h+Z50FTFPV7A92U3l//hmtQv3zPHZq3dXa hATdTlN5yzAB4rzbGER6JnJ9o18/j88UyFDNQ9C9cOnCiTTxfPoRN8A9BblBvH8Bbf Hm7FcWghPSftRbxs3rMoUke9ioOeuQsjc01hM52w= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Daniel Mack , Haojian Zhuang , Robert Jarzmik , Felipe Balbi Subject: [PATCH 20/22] USB: gadget: udc: pxa27x_udc: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:31:05 +0200 Message-Id: <20180529153107.12791-20-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: Daniel Mack Cc: Haojian Zhuang Cc: Robert Jarzmik Cc: Felipe Balbi Signed-off-by: Greg Kroah-Hartman Acked-by: Robert Jarzmik --- drivers/usb/gadget/udc/pxa27x_udc.c | 43 ++++------------------------- drivers/usb/gadget/udc/pxa27x_udc.h | 3 -- 2 files changed, 6 insertions(+), 40 deletions(-) diff --git a/drivers/usb/gadget/udc/pxa27x_udc.c b/drivers/usb/gadget/udc/pxa27x_udc.c index a58242e901df..014233252299 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.c +++ b/drivers/usb/gadget/udc/pxa27x_udc.c @@ -205,50 +205,19 @@ DEFINE_SHOW_ATTRIBUTE(eps_dbg); static void pxa_init_debugfs(struct pxa_udc *udc) { - struct dentry *root, *state, *queues, *eps; + struct dentry *root; root = debugfs_create_dir(udc->gadget.name, NULL); - if (IS_ERR(root) || !root) - goto err_root; - - state = debugfs_create_file("udcstate", 0400, root, udc, - &state_dbg_fops); - if (!state) - goto err_state; - queues = debugfs_create_file("queues", 0400, root, udc, - &queues_dbg_fops); - if (!queues) - goto err_queues; - eps = debugfs_create_file("epstate", 0400, root, udc, - &eps_dbg_fops); - if (!eps) - goto err_eps; - udc->debugfs_root = root; - udc->debugfs_state = state; - udc->debugfs_queues = queues; - udc->debugfs_eps = eps; - return; -err_eps: - debugfs_remove(eps); -err_queues: - debugfs_remove(queues); -err_state: - debugfs_remove(root); -err_root: - dev_err(udc->dev, "debugfs is not available\n"); + + debugfs_create_file("udcstate", 0400, root, udc, &state_dbg_fops); + debugfs_create_file("queues", 0400, root, udc, &queues_dbg_fops); + debugfs_create_file("epstate", 0400, root, udc, &eps_dbg_fops); } static void pxa_cleanup_debugfs(struct pxa_udc *udc) { - debugfs_remove(udc->debugfs_eps); - debugfs_remove(udc->debugfs_queues); - debugfs_remove(udc->debugfs_state); - debugfs_remove(udc->debugfs_root); - udc->debugfs_eps = NULL; - udc->debugfs_queues = NULL; - udc->debugfs_state = NULL; - udc->debugfs_root = NULL; + debugfs_remove_recursive(udc->debugfs_root); } #else diff --git a/drivers/usb/gadget/udc/pxa27x_udc.h b/drivers/usb/gadget/udc/pxa27x_udc.h index 1128d39a4255..13b2977399ab 100644 --- a/drivers/usb/gadget/udc/pxa27x_udc.h +++ b/drivers/usb/gadget/udc/pxa27x_udc.h @@ -476,9 +476,6 @@ struct pxa_udc { #endif #ifdef CONFIG_USB_GADGET_DEBUG_FS struct dentry *debugfs_root; - struct dentry *debugfs_state; - struct dentry *debugfs_queues; - struct dentry *debugfs_eps; #endif }; #define to_pxa(g) (container_of((g), struct pxa_udc, gadget))