From patchwork Wed Jun 12 12:12:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989755 X-Patchwork-Delegate: andy.shevchenko@gmail.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F6901708 for ; Wed, 12 Jun 2019 12:13:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CC41289A7 for ; Wed, 12 Jun 2019 12:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4EF2828A19; Wed, 12 Jun 2019 12:13:39 +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.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI 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 DFDD028A19 for ; Wed, 12 Jun 2019 12:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438558AbfFLMNZ (ORCPT ); Wed, 12 Jun 2019 08:13:25 -0400 Received: from mail.kernel.org ([198.145.29.99]:53614 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728433AbfFLMNZ (ORCPT ); Wed, 12 Jun 2019 08:13:25 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 EA76921019; Wed, 12 Jun 2019 12:13:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341604; bh=mnEMQqcIZyYYy6tRZgovJ/xEPKXIK1opq3MoAC4IEm4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HzceL25iFwN+uLKR4EGITNhSGQ6T7NO/oZ3loXq20Fo/OVblYG4fLfmNcOi2mAKSl LzF1AkWUcufE9swWLie2GPear9RDY+LUOdxIqrEcYE6w59yAhETcZX1GdzCzbQOhsj YExdh3JZuvU3OinDTeHwj7+jtLti3MKnCMn1Rpww= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/8] platform: x86: pmc_atom: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:56 +0200 Message-Id: <20190612121258.19535-6-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190612121258.19535-1-gregkh@linuxfoundation.org> References: <20190612121258.19535-1-gregkh@linuxfoundation.org> MIME-Version: 1.0 Sender: platform-driver-x86-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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: Darren Hart Cc: Andy Shevchenko Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/pmc_atom.c | 43 ++++++++------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/drivers/platform/x86/pmc_atom.c b/drivers/platform/x86/pmc_atom.c index b1d804376237..2104e1ad38d9 100644 --- a/drivers/platform/x86/pmc_atom.c +++ b/drivers/platform/x86/pmc_atom.c @@ -350,45 +350,24 @@ static int pmc_sleep_tmr_show(struct seq_file *s, void *unused) DEFINE_SHOW_ATTRIBUTE(pmc_sleep_tmr); -static void pmc_dbgfs_unregister(struct pmc_dev *pmc) +static void pmc_dbgfs_register(struct pmc_dev *pmc) { - debugfs_remove_recursive(pmc->dbgfs_dir); -} - -static int pmc_dbgfs_register(struct pmc_dev *pmc) -{ - struct dentry *dir, *f; + struct dentry *dir; dir = debugfs_create_dir("pmc_atom", NULL); - if (!dir) - return -ENOMEM; pmc->dbgfs_dir = dir; - f = debugfs_create_file("dev_state", S_IFREG | S_IRUGO, - dir, pmc, &pmc_dev_state_fops); - if (!f) - goto err; - - f = debugfs_create_file("pss_state", S_IFREG | S_IRUGO, - dir, pmc, &pmc_pss_state_fops); - if (!f) - goto err; - - f = debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, - dir, pmc, &pmc_sleep_tmr_fops); - if (!f) - goto err; - - return 0; -err: - pmc_dbgfs_unregister(pmc); - return -ENODEV; + debugfs_create_file("dev_state", S_IFREG | S_IRUGO, dir, pmc, + &pmc_dev_state_fops); + debugfs_create_file("pss_state", S_IFREG | S_IRUGO, dir, pmc, + &pmc_pss_state_fops); + debugfs_create_file("sleep_state", S_IFREG | S_IRUGO, dir, pmc, + &pmc_sleep_tmr_fops); } #else -static int pmc_dbgfs_register(struct pmc_dev *pmc) +static void pmc_dbgfs_register(struct pmc_dev *pmc) { - return 0; } #endif /* CONFIG_DEBUG_FS */ @@ -500,9 +479,7 @@ static int pmc_setup_dev(struct pci_dev *pdev, const struct pci_device_id *ent) /* PMC hardware registers setup */ pmc_hw_reg_setup(pmc); - ret = pmc_dbgfs_register(pmc); - if (ret) - dev_warn(&pdev->dev, "debugfs register failed\n"); + pmc_dbgfs_register(pmc); /* Register platform clocks - PMC_PLT_CLK [0..5] */ ret = pmc_setup_clks(pdev, pmc->regmap, data);