All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] intel_ips: fix error handling for debugfs_create_dir()
@ 2013-07-19  5:51 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-19  5:51 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

If debugfs is not enabled then debugfs_create_dir() returns
ERR_PTR(-ENODEV).  Also my static checker complains that we are trying
to print the error code, but it's is always just NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 18dcb58..4416d92 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1328,7 +1328,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 	int i;
 
 	ips->debug_root = debugfs_create_dir("ips", NULL);
-	if (!ips->debug_root) {
+	if (IS_ERR_OR_NULL(ips->debug_root)) {
 		dev_err(&ips->dev->dev,
 			"failed to create debugfs entries: %ld\n",
 			PTR_ERR(ips->debug_root));
@@ -1343,7 +1343,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 		ent = debugfs_create_file(node->name, S_IFREG | S_IRUGO,
 					  ips->debug_root, node,
 					  &ips_debugfs_ops);
-		if (!ent) {
+		if (IS_ERR_OR_NULL(ent)) {
 			dev_err(&ips->dev->dev,
 				"failed to create debug file: %ld\n",
 				PTR_ERR(ent));

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch] intel_ips: fix error handling for debugfs_create_dir()
@ 2013-07-19  5:51 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-19  5:51 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

If debugfs is not enabled then debugfs_create_dir() returns
ERR_PTR(-ENODEV).  Also my static checker complains that we are trying
to print the error code, but it's is always just NULL.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 18dcb58..4416d92 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1328,7 +1328,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 	int i;
 
 	ips->debug_root = debugfs_create_dir("ips", NULL);
-	if (!ips->debug_root) {
+	if (IS_ERR_OR_NULL(ips->debug_root)) {
 		dev_err(&ips->dev->dev,
 			"failed to create debugfs entries: %ld\n",
 			PTR_ERR(ips->debug_root));
@@ -1343,7 +1343,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 		ent = debugfs_create_file(node->name, S_IFREG | S_IRUGO,
 					  ips->debug_root, node,
 					  &ips_debugfs_ops);
-		if (!ent) {
+		if (IS_ERR_OR_NULL(ent)) {
 			dev_err(&ips->dev->dev,
 				"failed to create debug file: %ld\n",
 				PTR_ERR(ent));

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [patch] intel_ips: fix error handling for debugfs_create_dir()
  2013-07-19  5:51 ` Dan Carpenter
@ 2013-07-21 14:56   ` Dan Carpenter
  -1 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-21 14:56 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

On Fri, Jul 19, 2013 at 08:51:44AM +0300, Dan Carpenter wrote:
> If debugfs is not enabled then debugfs_create_dir() returns
> ERR_PTR(-ENODEV).  Also my static checker complains that we are trying
> to print the error code, but it's is always just NULL.
> 

Sorry about this.  This patch is wrong.  Please ignore.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [patch] intel_ips: fix error handling for debugfs_create_dir()
@ 2013-07-21 14:56   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-21 14:56 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

On Fri, Jul 19, 2013 at 08:51:44AM +0300, Dan Carpenter wrote:
> If debugfs is not enabled then debugfs_create_dir() returns
> ERR_PTR(-ENODEV).  Also my static checker complains that we are trying
> to print the error code, but it's is always just NULL.
> 

Sorry about this.  This patch is wrong.  Please ignore.

regards,
dan carpenter


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [patch v2] intel_ips: cleanup a couple error messages
  2013-07-19  5:51 ` Dan Carpenter
@ 2013-07-22 20:38   ` Dan Carpenter
  -1 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-22 20:38 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

Printing PTR_ERR(NULL) is not useful so I have updated the error
messages a little.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: completely different

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 18dcb58..e5c115d 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1329,9 +1329,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 
 	ips->debug_root = debugfs_create_dir("ips", NULL);
 	if (!ips->debug_root) {
-		dev_err(&ips->dev->dev,
-			"failed to create debugfs entries: %ld\n",
-			PTR_ERR(ips->debug_root));
+		dev_err(&ips->dev->dev, "failed to create debugfs entries\n");
 		return;
 	}
 
@@ -1345,8 +1343,8 @@ static void ips_debugfs_init(struct ips_driver *ips)
 					  &ips_debugfs_ops);
 		if (!ent) {
 			dev_err(&ips->dev->dev,
-				"failed to create debug file: %ld\n",
-				PTR_ERR(ent));
+				"failed to create debug file: %s\n",
+				node->name);
 			goto err_cleanup;
 		}
 	}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [patch v2] intel_ips: cleanup a couple error messages
@ 2013-07-22 20:38   ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2013-07-22 20:38 UTC (permalink / raw)
  To: Matthew Garrett; +Cc: platform-driver-x86, kernel-janitors

Printing PTR_ERR(NULL) is not useful so I have updated the error
messages a little.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
v2: completely different

diff --git a/drivers/platform/x86/intel_ips.c b/drivers/platform/x86/intel_ips.c
index 18dcb58..e5c115d 100644
--- a/drivers/platform/x86/intel_ips.c
+++ b/drivers/platform/x86/intel_ips.c
@@ -1329,9 +1329,7 @@ static void ips_debugfs_init(struct ips_driver *ips)
 
 	ips->debug_root = debugfs_create_dir("ips", NULL);
 	if (!ips->debug_root) {
-		dev_err(&ips->dev->dev,
-			"failed to create debugfs entries: %ld\n",
-			PTR_ERR(ips->debug_root));
+		dev_err(&ips->dev->dev, "failed to create debugfs entries\n");
 		return;
 	}
 
@@ -1345,8 +1343,8 @@ static void ips_debugfs_init(struct ips_driver *ips)
 					  &ips_debugfs_ops);
 		if (!ent) {
 			dev_err(&ips->dev->dev,
-				"failed to create debug file: %ld\n",
-				PTR_ERR(ent));
+				"failed to create debug file: %s\n",
+				node->name);
 			goto err_cleanup;
 		}
 	}

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-07-22 20:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-19  5:51 [patch] intel_ips: fix error handling for debugfs_create_dir() Dan Carpenter
2013-07-19  5:51 ` Dan Carpenter
2013-07-21 14:56 ` Dan Carpenter
2013-07-21 14:56   ` Dan Carpenter
2013-07-22 20:38 ` [patch v2] intel_ips: cleanup a couple error messages Dan Carpenter
2013-07-22 20:38   ` Dan Carpenter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.