From patchwork Tue May 29 15:30:48 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10436259 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 4149C602BF for ; Tue, 29 May 2018 15:32:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 326BE28782 for ; Tue, 29 May 2018 15:32:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276E62888E; Tue, 29 May 2018 15:32:22 +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 804D528889 for ; Tue, 29 May 2018 15:32:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935543AbeE2PcU (ORCPT ); Tue, 29 May 2018 11:32:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:40020 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935260AbeE2PcS (ORCPT ); Tue, 29 May 2018 11:32:18 -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 6CA19208A1; Tue, 29 May 2018 15:32:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527607937; bh=DNlpeK+hlcWTOWS2OMbFuR0NY9m2njpGqFZinReO24w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gpz68Ly5LOTzX3x/1R+UMq35hbk9tYzYG97ixXNY24DSjmMgxuowYjRusPhwDLzUA abI1T8n49kXYfVyPQ88UC0p3c4XJ4CHJQx0caPpgDZDliYMqRMNDmvrrI+S/otNufU 9A+7bGz4BBaNPB6jSfI3YoHG0SyWNN9FiT8bOCpY= From: Greg Kroah-Hartman To: linux-usb@vger.kernel.org Cc: Greg Kroah-Hartman , Bin Liu Subject: [PATCH 03/22] USB: musb: clean up debugfs file and directory creation Date: Tue, 29 May 2018 17:30:48 +0200 Message-Id: <20180529153107.12791-3-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. Because of this, lots of init functions do not need to have return values, so this cleans up a lot of unused error handling code that never could have triggered in the past. Cc: Bin Liu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/musb/musb_core.c | 5 +--- drivers/usb/musb/musb_debug.h | 5 ++-- drivers/usb/musb/musb_debugfs.c | 44 ++++++--------------------------- drivers/usb/musb/musb_dsps.c | 9 +------ 4 files changed, 11 insertions(+), 52 deletions(-) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index 5cc64980058b..b7d56272f9d1 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -2387,9 +2387,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) if (status < 0) goto fail3; - status = musb_init_debugfs(musb); - if (status < 0) - goto fail4; + musb_init_debugfs(musb); status = sysfs_create_group(&musb->controller->kobj, &musb_attr_group); if (status) @@ -2404,7 +2402,6 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) fail5: musb_exit_debugfs(musb); -fail4: musb_gadget_cleanup(musb); musb_host_cleanup(musb); diff --git a/drivers/usb/musb/musb_debug.h b/drivers/usb/musb/musb_debug.h index 5e0f079dde21..c444a80fe1da 100644 --- a/drivers/usb/musb/musb_debug.h +++ b/drivers/usb/musb/musb_debug.h @@ -20,12 +20,11 @@ void musb_dbg(struct musb *musb, const char *fmt, ...); #ifdef CONFIG_DEBUG_FS -int musb_init_debugfs(struct musb *musb); +void musb_init_debugfs(struct musb *musb); void musb_exit_debugfs(struct musb *musb); #else -static inline int musb_init_debugfs(struct musb *musb) +static inline void musb_init_debugfs(struct musb *musb) { - return 0; } static inline void musb_exit_debugfs(struct musb *musb) { diff --git a/drivers/usb/musb/musb_debugfs.c b/drivers/usb/musb/musb_debugfs.c index e2050cac3eae..f42858e2b54c 100644 --- a/drivers/usb/musb/musb_debugfs.c +++ b/drivers/usb/musb/musb_debugfs.c @@ -321,48 +321,18 @@ static const struct file_operations musb_softconnect_fops = { .release = single_release, }; -int musb_init_debugfs(struct musb *musb) +void musb_init_debugfs(struct musb *musb) { - struct dentry *root; - struct dentry *file; - int ret; + struct dentry *root; root = debugfs_create_dir(dev_name(musb->controller), NULL); - if (!root) { - ret = -ENOMEM; - goto err0; - } - - file = debugfs_create_file("regdump", S_IRUGO, root, musb, - &musb_regdump_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - - file = debugfs_create_file("testmode", S_IRUGO | S_IWUSR, - root, musb, &musb_test_mode_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - - file = debugfs_create_file("softconnect", S_IRUGO | S_IWUSR, - root, musb, &musb_softconnect_fops); - if (!file) { - ret = -ENOMEM; - goto err1; - } - musb->debugfs_root = root; - return 0; - -err1: - debugfs_remove_recursive(root); - -err0: - return ret; + debugfs_create_file("regdump", S_IRUGO, root, musb, &musb_regdump_fops); + debugfs_create_file("testmode", S_IRUGO | S_IWUSR, root, musb, + &musb_test_mode_fops); + debugfs_create_file("softconnect", S_IRUGO | S_IWUSR, root, musb, + &musb_softconnect_fops); } void /* __init_or_exit */ musb_exit_debugfs(struct musb *musb) diff --git a/drivers/usb/musb/musb_dsps.c b/drivers/usb/musb/musb_dsps.c index cfe6bfcbeb5d..fb871eabcc10 100644 --- a/drivers/usb/musb/musb_dsps.c +++ b/drivers/usb/musb/musb_dsps.c @@ -399,24 +399,17 @@ static irqreturn_t dsps_interrupt(int irq, void *hci) static int dsps_musb_dbg_init(struct musb *musb, struct dsps_glue *glue) { struct dentry *root; - struct dentry *file; char buf[128]; sprintf(buf, "%s.dsps", dev_name(musb->controller)); root = debugfs_create_dir(buf, NULL); - if (!root) - return -ENOMEM; glue->dbgfs_root = root; glue->regset.regs = dsps_musb_regs; glue->regset.nregs = ARRAY_SIZE(dsps_musb_regs); glue->regset.base = musb->ctrl_base; - file = debugfs_create_regset32("regdump", S_IRUGO, root, &glue->regset); - if (!file) { - debugfs_remove_recursive(root); - return -ENOMEM; - } + debugfs_create_regset32("regdump", S_IRUGO, root, &glue->regset); return 0; }