From patchwork Wed Jun 12 12:12:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989745 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 028B314B6 for ; Wed, 12 Jun 2019 12:13:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E41E628A19 for ; Wed, 12 Jun 2019 12:13:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D85F128A1E; Wed, 12 Jun 2019 12:13:07 +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 7490728A19 for ; Wed, 12 Jun 2019 12:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726963AbfFLMNH (ORCPT ); Wed, 12 Jun 2019 08:13:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:53286 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfFLMNG (ORCPT ); Wed, 12 Jun 2019 08:13:06 -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 7B20A208C2; Wed, 12 Jun 2019 12:13:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341586; bh=u6+QfhTdC84UGP3uD6drBmy8AzLg6rTBFjv6qN+rV7U=; h=From:To:Cc:Subject:Date:From; b=1i+HmfwBwxsBg4QZGtn5RFlNgABFojDI0lKlCihgLE8lZJpTlwf1rlNA6edMAzAJG DP18t54RXiluJz4zwvlAMjG8LlISemQL3+KMPUnb1ID8lnxndmkNa5Z9wHq9esN1A3 LI+x/N1GoPcREOyHMTYDnrfmGcq1laGyvBCIetZw= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , "Lee, Chun-Yi" , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/8] platform: x86: acer-wmi: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:51 +0200 Message-Id: <20190612121258.19535-1-gregkh@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 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. Also, because there is no need to save the file dentry, remove the variable that was saving it and just recursively delete the whole directory. Cc: "Lee, Chun-Yi" 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/acer-wmi.c | 29 +++++------------------------ 1 file changed, 5 insertions(+), 24 deletions(-) diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c index 521b526cd467..f8f0e98b1f0b 100644 --- a/drivers/platform/x86/acer-wmi.c +++ b/drivers/platform/x86/acer-wmi.c @@ -259,7 +259,6 @@ struct acer_data { struct acer_debug { struct dentry *root; - struct dentry *devices; u32 wmid_devices; }; @@ -2148,29 +2147,15 @@ static struct platform_device *acer_platform_device; static void remove_debugfs(void) { - debugfs_remove(interface->debug.devices); - debugfs_remove(interface->debug.root); + debugfs_remove_recursive(interface->debug.root); } -static int __init create_debugfs(void) +static void __init create_debugfs(void) { interface->debug.root = debugfs_create_dir("acer-wmi", NULL); - if (!interface->debug.root) { - pr_err("Failed to create debugfs directory"); - return -ENOMEM; - } - interface->debug.devices = debugfs_create_u32("devices", S_IRUGO, - interface->debug.root, - &interface->debug.wmid_devices); - if (!interface->debug.devices) - goto error_debugfs; - - return 0; - -error_debugfs: - remove_debugfs(); - return -ENOMEM; + debugfs_create_u32("devices", S_IRUGO, interface->debug.root, + &interface->debug.wmid_devices); } static int __init acer_wmi_init(void) @@ -2300,9 +2285,7 @@ static int __init acer_wmi_init(void) if (wmi_has_guid(WMID_GUID2)) { interface->debug.wmid_devices = get_wmid_devices(); - err = create_debugfs(); - if (err) - goto error_create_debugfs; + create_debugfs(); } /* Override any initial settings with values from the commandline */ @@ -2310,8 +2293,6 @@ static int __init acer_wmi_init(void) return 0; -error_create_debugfs: - platform_device_del(acer_platform_device); error_device_add: platform_device_put(acer_platform_device); error_device_alloc: From patchwork Wed Jun 12 12:12:52 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989749 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 15CCA1708 for ; Wed, 12 Jun 2019 12:13:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 03A4F28A1B for ; Wed, 12 Jun 2019 12:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E955D28A19; Wed, 12 Jun 2019 12:13:19 +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 8091F28A19 for ; Wed, 12 Jun 2019 12:13:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731321AbfFLMNT (ORCPT ); Wed, 12 Jun 2019 08:13:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53402 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfFLMNP (ORCPT ); Wed, 12 Jun 2019 08:13:15 -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 63C27208C4; Wed, 12 Jun 2019 12:13:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341593; bh=HEfVF3kXxJ0nC/WZgJnYTwFfoLD22fZO73D9qujcDW0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uly5nhvqu+cerVeYBgywQQJ0UwSMl6Ifr/guGTXQVODWkOj6CgbNDKDo8ju5vus7/ a7sg0+ot4IZ0H3oWXRpJwjqP1PitvtQvuKJ/2u76Kh3XQ0EktwCYlzeHB7bb3toIY1 CKAP7QnDPgYo/Fk1aMRXvshU4DIkKRv8Ov3iRTFo= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Corentin Chary , acpi4asus-user@lists.sourceforge.net, platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/8] platform: x86: asus-wmi: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:52 +0200 Message-Id: <20190612121258.19535-2-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: Corentin Chary Cc: Darren Hart Cc: Andy Shevchenko Cc: acpi4asus-user@lists.sourceforge.net Cc: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/platform/x86/asus-wmi.c | 47 ++++++++------------------------- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/drivers/platform/x86/asus-wmi.c b/drivers/platform/x86/asus-wmi.c index 3e4336025e8f..4e3786eae349 100644 --- a/drivers/platform/x86/asus-wmi.c +++ b/drivers/platform/x86/asus-wmi.c @@ -2005,50 +2005,29 @@ static void asus_wmi_debugfs_exit(struct asus_wmi *asus) debugfs_remove_recursive(asus->debug.root); } -static int asus_wmi_debugfs_init(struct asus_wmi *asus) +static void asus_wmi_debugfs_init(struct asus_wmi *asus) { - struct dentry *dent; int i; asus->debug.root = debugfs_create_dir(asus->driver->name, NULL); - if (!asus->debug.root) { - pr_err("failed to create debugfs directory\n"); - goto error_debugfs; - } - dent = debugfs_create_x32("method_id", S_IRUGO | S_IWUSR, - asus->debug.root, &asus->debug.method_id); - if (!dent) - goto error_debugfs; + debugfs_create_x32("method_id", S_IRUGO | S_IWUSR, asus->debug.root, + &asus->debug.method_id); - dent = debugfs_create_x32("dev_id", S_IRUGO | S_IWUSR, - asus->debug.root, &asus->debug.dev_id); - if (!dent) - goto error_debugfs; + debugfs_create_x32("dev_id", S_IRUGO | S_IWUSR, asus->debug.root, + &asus->debug.dev_id); - dent = debugfs_create_x32("ctrl_param", S_IRUGO | S_IWUSR, - asus->debug.root, &asus->debug.ctrl_param); - if (!dent) - goto error_debugfs; + debugfs_create_x32("ctrl_param", S_IRUGO | S_IWUSR, asus->debug.root, + &asus->debug.ctrl_param); for (i = 0; i < ARRAY_SIZE(asus_wmi_debug_files); i++) { struct asus_wmi_debugfs_node *node = &asus_wmi_debug_files[i]; node->asus = asus; - dent = debugfs_create_file(node->name, S_IFREG | S_IRUGO, - asus->debug.root, node, - &asus_wmi_debugfs_io_ops); - if (!dent) { - pr_err("failed to create debug file: %s\n", node->name); - goto error_debugfs; - } + debugfs_create_file(node->name, S_IFREG | S_IRUGO, + asus->debug.root, node, + &asus_wmi_debugfs_io_ops); } - - return 0; - -error_debugfs: - asus_wmi_debugfs_exit(asus); - return -ENOMEM; } static int asus_wmi_fan_init(struct asus_wmi *asus) @@ -2162,14 +2141,10 @@ static int asus_wmi_add(struct platform_device *pdev) goto fail_wmi_handler; } - err = asus_wmi_debugfs_init(asus); - if (err) - goto fail_debugfs; + asus_wmi_debugfs_init(asus); return 0; -fail_debugfs: - wmi_remove_notify_handler(asus->driver->event_guid); fail_wmi_handler: asus_wmi_backlight_exit(asus); fail_backlight: From patchwork Wed Jun 12 12:12:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989763 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 E3DE21398 for ; Wed, 12 Jun 2019 12:13:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D088B289A7 for ; Wed, 12 Jun 2019 12:13:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C45B328A1B; Wed, 12 Jun 2019 12:13:46 +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 3D54E289A7 for ; Wed, 12 Jun 2019 12:13:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728504AbfFLMNT (ORCPT ); Wed, 12 Jun 2019 08:13:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:53456 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727584AbfFLMNR (ORCPT ); Wed, 12 Jun 2019 08:13:17 -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 18D67208CA; Wed, 12 Jun 2019 12:13:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341596; bh=4SmLU4+bYJ493/LkbHQOOJEWVZjXMM4kmuEWI0pnj34=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xOic1LtMPlrND0Iel66b8vgdJ7aZZGUHA0gdaxVVqLFftppZ4ge75LL2t1hQUAec+ jQXWgUFJKI7Y8Teo8jvMjZWX9IfBLmuowqfKCNpxj4+S9sQjAVtC0HnDjaseaU71IO chGqJDMMpFCgcs98V/JHE1/9vwIzRY2GMJ8baHSo= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Matthew Garrett , =?utf-8?q?Pali_Roh=C3=A1r?= , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/8] platform: x86: dell-laptop: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:53 +0200 Message-Id: <20190612121258.19535-3-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: Matthew Garrett Cc: "Pali Rohár" 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 Reviewed-by: Pali Rohár --- drivers/platform/x86/dell-laptop.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/x86/dell-laptop.c b/drivers/platform/x86/dell-laptop.c index a561f653cf13..94a2f259031c 100644 --- a/drivers/platform/x86/dell-laptop.c +++ b/drivers/platform/x86/dell-laptop.c @@ -2176,9 +2176,8 @@ static int __init dell_init(void) kbd_led_init(&platform_device->dev); dell_laptop_dir = debugfs_create_dir("dell_laptop", NULL); - if (dell_laptop_dir != NULL) - debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL, - &dell_debugfs_fops); + debugfs_create_file("rfkill", 0444, dell_laptop_dir, NULL, + &dell_debugfs_fops); dell_laptop_register_notifier(&dell_laptop_notifier); From patchwork Wed Jun 12 12:12:54 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989761 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 2021A1708 for ; Wed, 12 Jun 2019 12:13:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0E722289A7 for ; Wed, 12 Jun 2019 12:13:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 02C6028A19; Wed, 12 Jun 2019 12:13:45 +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 8D55428A1B for ; Wed, 12 Jun 2019 12:13:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438686AbfFLMNm (ORCPT ); Wed, 12 Jun 2019 08:13:42 -0400 Received: from mail.kernel.org ([198.145.29.99]:53500 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731398AbfFLMNT (ORCPT ); Wed, 12 Jun 2019 08:13:19 -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 ADCD121019; Wed, 12 Jun 2019 12:13:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341599; bh=meMOfm/cp2ZdmdOTfHwzOUf3Ik63/BpInCj8Dv0OURk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bwxd+mORdOMEwy7oRUBVQ9NGUlquywuNXh1lFe/AvAVgSH1inkX1PrSyx8eWaqoFS O1mdBM1EMzjnyxUwdVyLlgxdZLaSDJkz5ULfVpGAqKuTpJzAOiLQv/VV+xlUcvhU2H bI5TP2yyMMQHPgVYww5iIsAA2Q+Dt63Q/FYxyJZE= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Ike Panhc , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/8] platform: x86: ideapad-laptop: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:54 +0200 Message-Id: <20190612121258.19535-4-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: Ike Panhc 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/ideapad-laptop.c | 36 ++++++--------------------- 1 file changed, 7 insertions(+), 29 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 5fb9bfdf1019..7598cd46cf60 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -316,34 +316,15 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) } DEFINE_SHOW_ATTRIBUTE(debugfs_cfg); -static int ideapad_debugfs_init(struct ideapad_private *priv) +static void ideapad_debugfs_init(struct ideapad_private *priv) { - struct dentry *node; + struct dentry *dir; - priv->debug = debugfs_create_dir("ideapad", NULL); - if (priv->debug == NULL) { - pr_err("failed to create debugfs directory"); - goto errout; - } - - node = debugfs_create_file("cfg", S_IRUGO, priv->debug, priv, - &debugfs_cfg_fops); - if (!node) { - pr_err("failed to create cfg in debugfs"); - goto errout; - } - - node = debugfs_create_file("status", S_IRUGO, priv->debug, priv, - &debugfs_status_fops); - if (!node) { - pr_err("failed to create status in debugfs"); - goto errout; - } - - return 0; + dir = debugfs_create_dir("ideapad", NULL); + priv->debug = dir; -errout: - return -ENOMEM; + debugfs_create_file("cfg", S_IRUGO, dir, priv, &debugfs_cfg_fops); + debugfs_create_file("status", S_IRUGO, dir, priv, &debugfs_status_fops); } static void ideapad_debugfs_exit(struct ideapad_private *priv) @@ -1012,9 +993,7 @@ static int ideapad_acpi_add(struct platform_device *pdev) if (ret) return ret; - ret = ideapad_debugfs_init(priv); - if (ret) - goto debugfs_failed; + ideapad_debugfs_init(priv); ret = ideapad_input_init(priv); if (ret) @@ -1071,7 +1050,6 @@ static int ideapad_acpi_add(struct platform_device *pdev) ideapad_input_exit(priv); input_failed: ideapad_debugfs_exit(priv); -debugfs_failed: ideapad_sysfs_exit(priv); return ret; } From patchwork Wed Jun 12 12:12:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989757 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 BE3951708 for ; Wed, 12 Jun 2019 12:13:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ABE58289A7 for ; Wed, 12 Jun 2019 12:13:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A072328A1B; Wed, 12 Jun 2019 12:13:40 +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 2CCF028A19 for ; Wed, 12 Jun 2019 12:13:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730924AbfFLMNX (ORCPT ); Wed, 12 Jun 2019 08:13:23 -0400 Received: from mail.kernel.org ([198.145.29.99]:53562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727584AbfFLMNX (ORCPT ); Wed, 12 Jun 2019 08:13:23 -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 4C286208CA; Wed, 12 Jun 2019 12:13:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341601; bh=s7t54JWbBuNtEvtmX8/LDytHT2xfujJQNzLt26RSLK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bpv41V0nZjIAJGFvc7NA4lGDoD2jotV0pKMKdLkbDoKvwAbdC+dDy7tx+ZGCwBmgg SjZVtWp2xpmn2nrLHllnPjEcxhgXi6aHs7JFxBLdvxrjJjD8e2k4sD+cM9MOTqhme6 m2fDURwhnGvWvxPkDME2wqzoFREMV9jobEbkoj8c= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Corentin Chary , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/8] platform: x86: samsung-laptop: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:55 +0200 Message-Id: <20190612121258.19535-5-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: Corentin Chary 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/samsung-laptop.c | 89 +++++++-------------------- 1 file changed, 23 insertions(+), 66 deletions(-) diff --git a/drivers/platform/x86/samsung-laptop.c b/drivers/platform/x86/samsung-laptop.c index 7b160ee98115..e84f11398c1b 100644 --- a/drivers/platform/x86/samsung-laptop.c +++ b/drivers/platform/x86/samsung-laptop.c @@ -1280,15 +1280,12 @@ static void samsung_debugfs_exit(struct samsung_laptop *samsung) debugfs_remove_recursive(samsung->debug.root); } -static int samsung_debugfs_init(struct samsung_laptop *samsung) +static void samsung_debugfs_init(struct samsung_laptop *samsung) { - struct dentry *dent; + struct dentry *root; - samsung->debug.root = debugfs_create_dir("samsung-laptop", NULL); - if (!samsung->debug.root) { - pr_err("failed to create debugfs directory"); - goto error_debugfs; - } + root = debugfs_create_dir("samsung-laptop", NULL); + samsung->debug.root = root; samsung->debug.f0000_wrapper.data = samsung->f0000_segment; samsung->debug.f0000_wrapper.size = 0xffff; @@ -1299,60 +1296,24 @@ static int samsung_debugfs_init(struct samsung_laptop *samsung) samsung->debug.sdiag_wrapper.data = samsung->sdiag; samsung->debug.sdiag_wrapper.size = strlen(samsung->sdiag); - dent = debugfs_create_u16("command", S_IRUGO | S_IWUSR, - samsung->debug.root, &samsung->debug.command); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_u32("d0", S_IRUGO | S_IWUSR, samsung->debug.root, - &samsung->debug.data.d0); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_u32("d1", S_IRUGO | S_IWUSR, samsung->debug.root, - &samsung->debug.data.d1); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_u16("d2", S_IRUGO | S_IWUSR, samsung->debug.root, - &samsung->debug.data.d2); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_u8("d3", S_IRUGO | S_IWUSR, samsung->debug.root, - &samsung->debug.data.d3); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_blob("data", S_IRUGO | S_IWUSR, - samsung->debug.root, - &samsung->debug.data_wrapper); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR, - samsung->debug.root, - &samsung->debug.f0000_wrapper); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_file("call", S_IFREG | S_IRUGO, - samsung->debug.root, samsung, - &samsung_laptop_call_fops); - if (!dent) - goto error_debugfs; - - dent = debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR, - samsung->debug.root, - &samsung->debug.sdiag_wrapper); - if (!dent) - goto error_debugfs; - - return 0; - -error_debugfs: - samsung_debugfs_exit(samsung); - return -ENOMEM; + debugfs_create_u16("command", S_IRUGO | S_IWUSR, root, + &samsung->debug.command); + debugfs_create_u32("d0", S_IRUGO | S_IWUSR, root, + &samsung->debug.data.d0); + debugfs_create_u32("d1", S_IRUGO | S_IWUSR, root, + &samsung->debug.data.d1); + debugfs_create_u16("d2", S_IRUGO | S_IWUSR, root, + &samsung->debug.data.d2); + debugfs_create_u8("d3", S_IRUGO | S_IWUSR, root, + &samsung->debug.data.d3); + debugfs_create_blob("data", S_IRUGO | S_IWUSR, root, + &samsung->debug.data_wrapper); + debugfs_create_blob("f0000_segment", S_IRUSR | S_IWUSR, root, + &samsung->debug.f0000_wrapper); + debugfs_create_file("call", S_IFREG | S_IRUGO, root, samsung, + &samsung_laptop_call_fops); + debugfs_create_blob("sdiag", S_IRUGO | S_IWUSR, root, + &samsung->debug.sdiag_wrapper); } static void samsung_sabi_exit(struct samsung_laptop *samsung) @@ -1745,9 +1706,7 @@ static int __init samsung_init(void) if (ret) goto error_lid_handling; - ret = samsung_debugfs_init(samsung); - if (ret) - goto error_debugfs; + samsung_debugfs_init(samsung); samsung->pm_nb.notifier_call = samsung_pm_notification; register_pm_notifier(&samsung->pm_nb); @@ -1755,8 +1714,6 @@ static int __init samsung_init(void) samsung_platform_device = samsung->platform_device; return ret; -error_debugfs: - samsung_lid_handling_exit(samsung); error_lid_handling: samsung_leds_exit(samsung); error_leds: 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); From patchwork Wed Jun 12 12:12:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989751 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 1D3561398 for ; Wed, 12 Jun 2019 12:13:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0915C289A7 for ; Wed, 12 Jun 2019 12:13:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F0B9728A1E; Wed, 12 Jun 2019 12:13:30 +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 8D967289A7 for ; Wed, 12 Jun 2019 12:13:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438672AbfFLMN3 (ORCPT ); Wed, 12 Jun 2019 08:13:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:53662 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727826AbfFLMN1 (ORCPT ); Wed, 12 Jun 2019 08:13:27 -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 A1C75208C4; Wed, 12 Jun 2019 12:13:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341607; bh=H4DWvHq5GmInPvRkYviYUkhahmtQnlyzUK8i8dLGyQI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=COp3l3ZrH3oGWLyE5ohcNxTV8qttbGU/czbXk98sKnQ2Nv9WntV4UFiO/2iw1c3VK KqN121BQvCa2r62aBL+izOxuOkMnNBzbwoy40WXHquCGkoLdEe9+9IcHVNazEg3l2I IfJZU3MM3ag6s0RZ8w21/jh/CW18lkMohOOK3rUQ= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Rajneesh Bhardwaj , Vishwanath Somayaji , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/8] platform: x86: intel_pmc: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:57 +0200 Message-Id: <20190612121258.19535-7-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: Rajneesh Bhardwaj Cc: Vishwanath Somayaji 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/intel_pmc_core.c | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c index 1d902230ba61..27d6470e43ec 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -753,14 +753,11 @@ static void pmc_core_dbgfs_unregister(struct pmc_dev *pmcdev) debugfs_remove_recursive(pmcdev->dbgfs_dir); } -static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) +static void pmc_core_dbgfs_register(struct pmc_dev *pmcdev) { struct dentry *dir; dir = debugfs_create_dir("pmc_core", NULL); - if (!dir) - return -ENOMEM; - pmcdev->dbgfs_dir = dir; debugfs_create_file("slp_s0_residency_usec", 0444, dir, pmcdev, @@ -794,13 +791,10 @@ static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) debugfs_create_bool("slp_s0_dbg_latch", 0644, dir, &slps0_dbg_latch); } - - return 0; } #else -static inline int pmc_core_dbgfs_register(struct pmc_dev *pmcdev) +static inline void pmc_core_dbgfs_register(struct pmc_dev *pmcdev) { - return 0; } static inline void pmc_core_dbgfs_unregister(struct pmc_dev *pmcdev) @@ -862,7 +856,6 @@ static int pmc_core_probe(struct platform_device *pdev) struct pmc_dev *pmcdev = &pmc; const struct x86_cpu_id *cpu_id; u64 slp_s0_addr; - int err; if (device_initialized) return -ENODEV; @@ -896,12 +889,7 @@ static int pmc_core_probe(struct platform_device *pdev) pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit(); dmi_check_system(pmc_core_dmi_table); - err = pmc_core_dbgfs_register(pmcdev); - if (err < 0) { - dev_warn(&pdev->dev, "debugfs register failed.\n"); - iounmap(pmcdev->regbase); - return err; - } + pmc_core_dbgfs_register(pmcdev); device_initialized = true; dev_info(&pdev->dev, " initialized\n"); From patchwork Wed Jun 12 12:12:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 10989753 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 45CF21398 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 30055289A7 for ; Wed, 12 Jun 2019 12:13:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 246D528A1E; 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 A873C289A7 for ; Wed, 12 Jun 2019 12:13:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2438688AbfFLMNd (ORCPT ); Wed, 12 Jun 2019 08:13:33 -0400 Received: from mail.kernel.org ([198.145.29.99]:53714 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2438674AbfFLMNa (ORCPT ); Wed, 12 Jun 2019 08:13:30 -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 4B10C2173C; Wed, 12 Jun 2019 12:13:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560341609; bh=VzkLSGcPjGZ9zxQTwow3pQZPqT0PVx6/J+e/zLME1/s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xIWVqNFE2nkFvJpuwYJPFllQ7QHMXPFGKAwUffq7vm6sBOZDxe4NeBynIO5OyfsFn qGueKqvHKONrl2RTzjLAJuqBmBXDquwWF0twnRgyCUNvPxsPEXlMxxXY8fmHhTUB5y F3QIsSdhBcDHHA4Sr16ou/mnQd85PzAWnMVP0OUc= From: Greg Kroah-Hartman To: dvhart@infradead.org, andy@infradead.org Cc: Greg Kroah-Hartman , Rajneesh Bhardwaj , "David E. Box" , platform-driver-x86@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 8/8] platform: x86: intel_telemetry: no need to check return value of debugfs_create functions Date: Wed, 12 Jun 2019 14:12:58 +0200 Message-Id: <20190612121258.19535-8-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: Rajneesh Bhardwaj Cc: "David E. Box" 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 --- .../platform/x86/intel_telemetry_debugfs.c | 78 ++++--------------- 1 file changed, 16 insertions(+), 62 deletions(-) diff --git a/drivers/platform/x86/intel_telemetry_debugfs.c b/drivers/platform/x86/intel_telemetry_debugfs.c index 98ba9185a27b..e84d3e983e0c 100644 --- a/drivers/platform/x86/intel_telemetry_debugfs.c +++ b/drivers/platform/x86/intel_telemetry_debugfs.c @@ -900,7 +900,7 @@ static int __init telemetry_debugfs_init(void) { const struct x86_cpu_id *id; int err; - struct dentry *f; + struct dentry *dir; /* Only APL supported for now */ id = x86_match_cpu(telemetry_debugfs_cpu_ids); @@ -923,68 +923,22 @@ static int __init telemetry_debugfs_init(void) register_pm_notifier(&pm_notifier); - err = -ENOMEM; - debugfs_conf->telemetry_dbg_dir = debugfs_create_dir("telemetry", NULL); - if (!debugfs_conf->telemetry_dbg_dir) - goto out_pm; - - f = debugfs_create_file("pss_info", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, NULL, - &telem_pss_states_fops); - if (!f) { - pr_err("pss_sample_info debugfs register failed\n"); - goto out; - } - - f = debugfs_create_file("ioss_info", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, NULL, - &telem_ioss_states_fops); - if (!f) { - pr_err("ioss_sample_info debugfs register failed\n"); - goto out; - } - - f = debugfs_create_file("soc_states", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, - NULL, &telem_soc_states_fops); - if (!f) { - pr_err("ioss_sample_info debugfs register failed\n"); - goto out; - } - - f = debugfs_create_file("s0ix_residency_usec", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, - NULL, &telem_s0ix_fops); - if (!f) { - pr_err("s0ix_residency_usec debugfs register failed\n"); - goto out; - } - - f = debugfs_create_file("pss_trace_verbosity", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, NULL, - &telem_pss_trc_verb_ops); - if (!f) { - pr_err("pss_trace_verbosity debugfs register failed\n"); - goto out; - } - - f = debugfs_create_file("ioss_trace_verbosity", S_IFREG | S_IRUGO, - debugfs_conf->telemetry_dbg_dir, NULL, - &telem_ioss_trc_verb_ops); - if (!f) { - pr_err("ioss_trace_verbosity debugfs register failed\n"); - goto out; - } - + dir = debugfs_create_dir("telemetry", NULL); + debugfs_conf->telemetry_dbg_dir = dir; + + debugfs_create_file("pss_info", S_IFREG | S_IRUGO, dir, NULL, + &telem_pss_states_fops); + debugfs_create_file("ioss_info", S_IFREG | S_IRUGO, dir, NULL, + &telem_ioss_states_fops); + debugfs_create_file("soc_states", S_IFREG | S_IRUGO, dir, NULL, + &telem_soc_states_fops); + debugfs_create_file("s0ix_residency_usec", S_IFREG | S_IRUGO, dir, NULL, + &telem_s0ix_fops); + debugfs_create_file("pss_trace_verbosity", S_IFREG | S_IRUGO, dir, NULL, + &telem_pss_trc_verb_ops); + debugfs_create_file("ioss_trace_verbosity", S_IFREG | S_IRUGO, dir, + NULL, &telem_ioss_trc_verb_ops); return 0; - -out: - debugfs_remove_recursive(debugfs_conf->telemetry_dbg_dir); - debugfs_conf->telemetry_dbg_dir = NULL; -out_pm: - unregister_pm_notifier(&pm_notifier); - - return err; } static void __exit telemetry_debugfs_exit(void)