public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Matthew Garrett <matthew.garrett@nebula.com>
Cc: platform-driver-x86@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: [patch] intel_ips: fix error handling for debugfs_create_dir()
Date: Fri, 19 Jul 2013 05:51:44 +0000	[thread overview]
Message-ID: <20130719055144.GE9729@elgon.mountain> (raw)

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));

             reply	other threads:[~2013-07-19  5:51 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-19  5:51 Dan Carpenter [this message]
2013-07-21 14:56 ` [patch] intel_ips: fix error handling for debugfs_create_dir() Dan Carpenter
2013-07-22 20:38 ` [patch v2] intel_ips: cleanup a couple error messages Dan Carpenter

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=20130719055144.GE9729@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=matthew.garrett@nebula.com \
    --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