From: Emil Goode <emilgoode@gmail.com>
To: giometti@enneenne.com
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org,
Emil Goode <emilgoode@gmail.com>
Subject: [PATCH] pps: Return PTR_ERR on error in device_create
Date: Fri, 01 Jun 2012 19:43:29 +0000 [thread overview]
Message-ID: <1338579809-11637-1-git-send-email-emilgoode@gmail.com> (raw)
We should return PTR_ERR if the call to the
device_create function fails.
Without this patch we instead return the value
from a successful call to cdev_add if the call
to device_create fails.
Signed-off-by: Emil Goode <emilgoode@gmail.com>
---
drivers/pps/pps.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c
index 98fbe62..e771487 100644
--- a/drivers/pps/pps.c
+++ b/drivers/pps/pps.c
@@ -327,8 +327,10 @@ int pps_register_cdev(struct pps_device *pps)
}
pps->dev = device_create(pps_class, pps->info.dev, devt, pps,
"pps%d", pps->id);
- if (IS_ERR(pps->dev))
+ if (IS_ERR(pps->dev)) {
+ err = PTR_ERR(pps->dev);
goto del_cdev;
+ }
pps->dev->release = pps_device_destruct;
--
1.7.10
next reply other threads:[~2012-06-01 19:43 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-01 19:43 Emil Goode [this message]
2012-07-14 7:31 ` [PATCH] pps: Return PTR_ERR on error in device_create devendra.aaru
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=1338579809-11637-1-git-send-email-emilgoode@gmail.com \
--to=emilgoode@gmail.com \
--cc=giometti@enneenne.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@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