From: Andrew Morton <akpm@linux-foundation.org>
To: Jani Nikula <ext-jani.1.nikula@nokia.com>
Cc: linux-kernel@vger.kernel.org, giometti@linux.it, vegard.nossum@gmail.com
Subject: Re: [PATCH] c2port: fix device_create() return value check
Date: Mon, 15 Mar 2010 15:13:18 -0700 [thread overview]
Message-ID: <20100315151318.641af1db.akpm@linux-foundation.org> (raw)
In-Reply-To: <1268324452-30589-1-git-send-email-ext-jani.1.nikula@nokia.com>
On Thu, 11 Mar 2010 18:20:52 +0200
Jani Nikula <ext-jani.1.nikula@nokia.com> wrote:
> From: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> Use IS_ERR() instead of comparing to NULL.
>
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> ---
>
> NOTE: I'm afraid I'm unable to test this; please consider this more a
> bug report than a complete patch.
> ---
> drivers/misc/c2port/core.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
> index b5346b4..3276216 100644
> --- a/drivers/misc/c2port/core.c
> +++ b/drivers/misc/c2port/core.c
> @@ -912,7 +912,7 @@ struct c2port_device *c2port_device_register(char *name,
>
> c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
> "c2port%d", id);
> - if (unlikely(!c2dev->dev)) {
> + if (unlikely(IS_ERR(c2dev->dev))) {
> ret = -ENOMEM;
> goto error_device_create;
> }
It looks right to me. Let's finish the job:
--- a/drivers/misc/c2port/core.c~c2port-fix-device_create-return-value-check-fix
+++ a/drivers/misc/c2port/core.c
@@ -913,7 +913,7 @@ struct c2port_device *c2port_device_regi
c2dev->dev = device_create(c2port_class, NULL, 0, c2dev,
"c2port%d", id);
if (unlikely(IS_ERR(c2dev->dev))) {
- ret = -ENOMEM;
+ ret = PTR_ERR(c2dev->dev);
goto error_device_create;
}
dev_set_drvdata(c2dev->dev, c2dev);
_
prev parent reply other threads:[~2010-03-15 22:13 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 16:20 [PATCH] c2port: fix device_create() return value check Jani Nikula
2010-03-15 22:13 ` Andrew Morton [this message]
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=20100315151318.641af1db.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=ext-jani.1.nikula@nokia.com \
--cc=giometti@linux.it \
--cc=linux-kernel@vger.kernel.org \
--cc=vegard.nossum@gmail.com \
/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