From: YueHaibing <yuehaibing@huawei.com>
To: <dvhart@infradead.org>, <andy@infradead.org>, <jkosina@suse.cz>
Cc: <linux-kernel@vger.kernel.org>,
<platform-driver-x86@vger.kernel.org>,
<andriy.shevchenko@linux.intel.com>,
YueHaibing <yuehaibing@huawei.com>
Subject: [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init
Date: Tue, 27 Nov 2018 11:09:38 +0800 [thread overview]
Message-ID: <20181127030938.18160-1-yuehaibing@huawei.com> (raw)
As Greg KH explained in:
https://lkml.org/lkml/2015/8/15/114
There no need to check the return value of debugfs_create_file/
debugfs_create_dir.
This also fix static code checker warnings:
drivers/platform/x86/intel_ips.c:1314
ips_debugfs_init() warn: passing zero to 'PTR_ERR'
drivers/platform/x86/intel_ips.c:1328
ips_debugfs_init() warn: passing zero to 'PTR_ERR'
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/platform/x86/intel_ips.c | 21 +++------------------
1 file changed, 3 insertions(+), 18 deletions(-)
diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 225638a..5c5dc82 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1310,32 +1310,17 @@ static void ips_debugfs_init(struct ips_driver *ips)
int i;
ips->debug_root = debugfs_create_dir("ips", NULL);
- if (!ips->debug_root) {
- dev_err(ips->dev, "failed to create debugfs entries: %ld\n",
- PTR_ERR(ips->debug_root));
- return;
- }
for (i = 0; i < ARRAY_SIZE(ips_debug_files); i++) {
- struct dentry *ent;
struct ips_debugfs_node *node = &ips_debug_files[i];
node->ips = ips;
- ent = debugfs_create_file(node->name, S_IFREG | S_IRUGO,
- ips->debug_root, node,
- &ips_debugfs_ops);
- if (!ent) {
- dev_err(ips->dev, "failed to create debug file: %ld\n",
- PTR_ERR(ent));
- goto err_cleanup;
- }
+ debugfs_create_file(node->name, S_IFREG | S_IRUGO,
+ ips->debug_root, node,
+ &ips_debugfs_ops);
}
return;
-
-err_cleanup:
- ips_debugfs_cleanup(ips);
- return;
}
#endif /* CONFIG_DEBUG_FS */
--
2.7.0
next reply other threads:[~2018-11-27 3:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-27 3:09 YueHaibing [this message]
2018-12-03 19:08 ` [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init Andy Shevchenko
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181127030938.18160-1-yuehaibing@huawei.com \
--to=yuehaibing@huawei.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=andy@infradead.org \
--cc=dvhart@infradead.org \
--cc=jkosina@suse.cz \
--cc=linux-kernel@vger.kernel.org \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).