From patchwork Tue May 29 15:31:01 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: 10436247 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 BB1AD601C7 for ; Tue, 29 May 2018 15:32:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABB392868F for ; Tue, 29 May 2018 15:32:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A06282889A; Tue, 29 May 2018 15:32:09 +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 2AF332868F for ; Tue, 29 May 2018 15:32:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935492AbeE2PcF (ORCPT ); Tue, 29 May 2018 11:32:05 -0400 Received: from mail.kernel.org ([198.145.29.99]:39878 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935078AbeE2PcD (ORCPT ); Tue, 29 May 2018 11:32:03 -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 C3CD120849; Tue, 29 May 2018 15:32:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607923; bh=/hwhrp/1srJLPcXOMZDmNIRUzeGZAd90yTLPZARJusM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=grIcw7uDGdehpaubWWKddz44Ps9zoV+dE+dgE47aqM9QfSxut47l6k4ujk0ornB2R T0UlCAZYHVwSiyKblJW0okqY9Fq0g2a1uGBHCqguVD1xyKkTEY3A8OSNt0vmdbKo8z J//IkPz2hZQloWAedonW+qiMZOdrxayNCNECDLzg= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Felipe Balbi Subject: [PATCH 16/22] USB: dwc3: no need to check return value of debugfs_create functions Date: Tue, 29 May 2018 17:31:01 +0200 Message-Id: <20180529153107.12791-16-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 Signed-off-by: Greg Kroah-Hartman Acked-by: Felipe Balbi --- drivers/usb/dwc3/debugfs.c | 43 ++++++++++---------------------------- 1 file changed, 11 insertions(+), 32 deletions(-) diff --git a/drivers/usb/dwc3/debugfs.c b/drivers/usb/dwc3/debugfs.c index 2f07be1e1f31..df8e73ec3342 100644 --- a/drivers/usb/dwc3/debugfs.c +++ b/drivers/usb/dwc3/debugfs.c @@ -716,9 +716,6 @@ static void dwc3_debugfs_create_endpoint_dir(struct dwc3_ep *dep, struct dentry *dir; dir = debugfs_create_dir(dep->name, parent); - if (IS_ERR_OR_NULL(dir)) - return; - dwc3_debugfs_create_endpoint_files(dep, dir); } @@ -740,49 +737,31 @@ static void dwc3_debugfs_create_endpoint_dirs(struct dwc3 *dwc, void dwc3_debugfs_init(struct dwc3 *dwc) { struct dentry *root; - struct dentry *file; - - root = debugfs_create_dir(dev_name(dwc->dev), NULL); - if (IS_ERR_OR_NULL(root)) { - if (!root) - dev_err(dwc->dev, "Can't create debugfs root\n"); - return; - } - dwc->root = root; dwc->regset = kzalloc(sizeof(*dwc->regset), GFP_KERNEL); - if (!dwc->regset) { - debugfs_remove_recursive(root); + if (!dwc->regset) return; - } dwc->regset->regs = dwc3_regs; dwc->regset->nregs = ARRAY_SIZE(dwc3_regs); dwc->regset->base = dwc->regs - DWC3_GLOBALS_REGS_START; - file = debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); - if (!file) - dev_dbg(dwc->dev, "Can't create debugfs regdump\n"); + root = debugfs_create_dir(dev_name(dwc->dev), NULL); + dwc->root = root; + + debugfs_create_regset32("regdump", S_IRUGO, root, dwc->regset); if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)) { - file = debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_mode_fops); - if (!file) - dev_dbg(dwc->dev, "Can't create debugfs mode\n"); + debugfs_create_file("mode", S_IRUGO | S_IWUSR, root, dwc, + &dwc3_mode_fops); } if (IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE) || IS_ENABLED(CONFIG_USB_DWC3_GADGET)) { - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, - dwc, &dwc3_testmode_fops); - if (!file) - dev_dbg(dwc->dev, "Can't create debugfs testmode\n"); - - file = debugfs_create_file("link_state", S_IRUGO | S_IWUSR, - root, dwc, &dwc3_link_state_fops); - if (!file) - dev_dbg(dwc->dev, "Can't create debugfs link_state\n"); - + debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, dwc, + &dwc3_testmode_fops); + debugfs_create_file("link_state", S_IRUGO | S_IWUSR, root, dwc, + &dwc3_link_state_fops); dwc3_debugfs_create_endpoint_dirs(dwc, root); } }