From: Jean Delvare <khali@linux-fr.org>
To: Akinobu Mita <akinobu.mita@gmail.com>,
Greg Kroah-Hartman <gregkh@suse.de>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH] i2c: Fix return value check
Date: Thu, 19 Oct 2006 12:11:15 +0200 [thread overview]
Message-ID: <20061019121115.70130d27.khali@linux-fr.org> (raw)
In-Reply-To: <20061019032801.GB20695@localhost>
Hi Akinobu,
On Thu, 19 Oct 2006 12:28:01 +0900, Akinobu Mita wrote:
> On Wed, Oct 18, 2006 at 04:54:50PM +0200, Jean Delvare wrote:
> > Patch looks correct, however class devices are going away soon, and
> > this patch will conflict with Greg's work:
> > http://www.kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/patches/driver-class/i2c-dev-device.patch
> >
> > So your patch should apply on top of Greg's, if still needed after his
> > changes. It might even be later folded into Greg's patch to make things
> > easier to handle.
>
> I made the patch on top of i2c-dev-device.patch
>
> Subject: i2c: Fix return value check
>
> device_create() returns error code as pointer on failures.
> This patch checks the return value of device_create() by using IS_ERR().
>
> Cc: Greg Kroah-Hartman <gregkh@suse.de>
> Cc: Jean Delvare <khali@linux-fr.org>
> Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
>
> drivers/i2c/i2c-dev.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> Index: work-fault-inject/drivers/i2c/i2c-dev.c
> ===================================================================
> --- work-fault-inject.orig/drivers/i2c/i2c-dev.c
> +++ work-fault-inject/drivers/i2c/i2c-dev.c
> @@ -417,8 +417,8 @@ static int i2cdev_attach_adapter(struct
> i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
> MKDEV(I2C_MAJOR, adap->nr),
> "i2c-%d", adap->nr);
> - if (!i2c_dev->dev) {
> - res = -ENODEV;
> + if (IS_ERR(i2c_dev->dev)) {
> + res = PTR_ERR(i2c_dev->dev);
> goto error;
> }
> res = device_create_file(i2c_dev->dev, &dev_attr_name);
Great, thanks. I've this in my tree now so it won't be lost.
Greg, do you want to fold this into i2c-dev-device.patch?
Thanks,
--
Jean Delvare
prev parent reply other threads:[~2006-10-19 10:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-10-17 6:24 [PATCH] i2c: Fix return value check Akinobu Mita
2006-10-18 14:54 ` Jean Delvare
2006-10-19 3:28 ` Akinobu Mita
2006-10-19 10:11 ` Jean Delvare [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=20061019121115.70130d27.khali@linux-fr.org \
--to=khali@linux-fr.org \
--cc=akinobu.mita@gmail.com \
--cc=gregkh@suse.de \
--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