Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=3bacb36db01c7541ffea21d4ff39219e8b211a5c
Commit:     3bacb36db01c7541ffea21d4ff39219e8b211a5c
Parent:     250d1bd3f4ed0b50d79b3ec81ccefbabb203f916
Author:     Akinobu Mita <[EMAIL PROTECTED]>
AuthorDate: Sun Dec 10 21:21:33 2006 +0100
Committer:  Jean Delvare <[EMAIL PROTECTED]>
CommitDate: Sun Dec 10 21:21:33 2006 +0100

    i2c: Fix return value check in i2c-dev
    
    device_create() returns error code as pointer on failures.
    This patch checks the return value of device_create() by using IS_ERR().
    
    Signed-off-by: Akinobu Mita <[EMAIL PROTECTED]>
    Cc: Greg Kroah-Hartman <[EMAIL PROTECTED]>
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
---
 drivers/i2c/i2c-dev.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index cf9381e..909428a 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -416,8 +416,8 @@ static int i2cdev_attach_adapter(struct i2c_adapter *adap)
        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);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to