From patchwork Tue May 29 15:31:04 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: 10436255 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 831A9601C7 for ; Tue, 29 May 2018 15:32:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 745722868F for ; Tue, 29 May 2018 15:32:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 68F3028893; Tue, 29 May 2018 15:32:16 +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 D87B32868F for ; Tue, 29 May 2018 15:32:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935536AbeE2PcO (ORCPT ); Tue, 29 May 2018 11:32:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:39962 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935435AbeE2PcL (ORCPT ); Tue, 29 May 2018 11:32:11 -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 344F220849; Tue, 29 May 2018 15:32:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607931; bh=H6el40xuVrkSXVw5I0IibdiKjqSW51u0M2T603C+F8I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dp8gHXu0V/JwX8Wc5q170JUx6f31V1tbaa5jS7obbJ6YvZZFEsQNgqz5jrzd+kBj8 9RKchkphMIBciYfBC9uvT6vudgw03H3OKFiHxX7ojO7czOMHZs0jIotCatKdl5QWHr UdUD62nQBXMjRc1wmWKRxIIraOLsQr6vRJrbc8Zc= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Felipe Balbi , Andy Shevchenko , "Paul E. McKenney" , Mark Rutland , Jaejoong Kim , Li Yang , Johan Hovold , Robert Jarzmik Subject: [PATCH 19/22] USB: gadget: udc: gr_udc: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:31:04 +0200 Message-Id: <20180529153107.12791-19-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: Felipe Balbi Cc: Andy Shevchenko Cc: "Paul E. McKenney" Cc: Mark Rutland Cc: Jaejoong Kim Cc: Li Yang Cc: Johan Hovold Cc: Robert Jarzmik Signed-off-by: Greg Kroah-Hartman --- drivers/usb/gadget/udc/gr_udc.c | 7 ++----- drivers/usb/gadget/udc/gr_udc.h | 1 - 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/usb/gadget/udc/gr_udc.c b/drivers/usb/gadget/udc/gr_udc.c index ca83c15d8ea4..729e60e49564 100644 --- a/drivers/usb/gadget/udc/gr_udc.c +++ b/drivers/usb/gadget/udc/gr_udc.c @@ -209,15 +209,12 @@ static void gr_dfs_create(struct gr_udc *dev) const char *name = "gr_udc_state"; dev->dfs_root = debugfs_create_dir(dev_name(dev->dev), NULL); - dev->dfs_state = debugfs_create_file(name, 0444, dev->dfs_root, dev, - &gr_dfs_fops); + debugfs_create_file(name, 0444, dev->dfs_root, dev, &gr_dfs_fops); } static void gr_dfs_delete(struct gr_udc *dev) { - /* Handles NULL and ERR pointers internally */ - debugfs_remove(dev->dfs_state); - debugfs_remove(dev->dfs_root); + debugfs_remove_recursive(dev->dfs_root); } #else /* !CONFIG_USB_GADGET_DEBUG_FS */ diff --git a/drivers/usb/gadget/udc/gr_udc.h b/drivers/usb/gadget/udc/gr_udc.h index 3e913268c8c5..417ad2aa2cc7 100644 --- a/drivers/usb/gadget/udc/gr_udc.h +++ b/drivers/usb/gadget/udc/gr_udc.h @@ -217,7 +217,6 @@ struct gr_udc { spinlock_t lock; /* General lock, a.k.a. "dev->lock" in comments */ struct dentry *dfs_root; - struct dentry *dfs_state; }; #define to_gr_udc(gadget) (container_of((gadget), struct gr_udc, gadget))