* [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init
@ 2018-11-27 3:09 YueHaibing
2018-12-03 19:08 ` Andy Shevchenko
0 siblings, 1 reply; 2+ messages in thread
From: YueHaibing @ 2018-11-27 3:09 UTC (permalink / raw)
To: dvhart, andy, jkosina
Cc: linux-kernel, platform-driver-x86, andriy.shevchenko, YueHaibing
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init
2018-11-27 3:09 [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init YueHaibing
@ 2018-12-03 19:08 ` Andy Shevchenko
0 siblings, 0 replies; 2+ messages in thread
From: Andy Shevchenko @ 2018-12-03 19:08 UTC (permalink / raw)
To: YueHaibing; +Cc: dvhart, andy, jkosina, linux-kernel, platform-driver-x86
On Tue, Nov 27, 2018 at 11:09:38AM +0800, YueHaibing wrote:
> 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'
>
Pushed to my review and testing queue, thanks!
> 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
>
>
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-12-03 19:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-27 3:09 [PATCH -next] platform/x86: intel-ips: remove unnecessary checks in ips_debugfs_init YueHaibing
2018-12-03 19:08 ` Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®