Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=07125ab2c2641e976bbaf3b89a735ad5a99e25d3
Commit:     07125ab2c2641e976bbaf3b89a735ad5a99e25d3
Parent:     3bacb36db01c7541ffea21d4ff39219e8b211a5c
Author:     Jean Delvare <[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: Refactor a kfree in i2c-dev
    
    Refactor kfree(i2c_dev) into return_i2c_dev(). This saves some
    code and makes more sense, as the memory is allocated in
    get_free_i2c_dev().
    
    Signed-off-by: Jean Delvare <[EMAIL PROTECTED]>
    Cc: Greg Kroah-Hartman <[EMAIL PROTECTED]>
---
 drivers/i2c/i2c-dev.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/i2c-dev.c b/drivers/i2c/i2c-dev.c
index 909428a..ac5bd2a 100644
--- a/drivers/i2c/i2c-dev.c
+++ b/drivers/i2c/i2c-dev.c
@@ -90,6 +90,7 @@ static void return_i2c_dev(struct i2c_dev *i2c_dev)
        spin_lock(&i2c_dev_list_lock);
        list_del(&i2c_dev->list);
        spin_unlock(&i2c_dev_list_lock);
+       kfree(i2c_dev);
 }
 
 static ssize_t show_adapter_name(struct device *dev,
@@ -431,7 +432,6 @@ error_destroy:
        device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
 error:
        return_i2c_dev(i2c_dev);
-       kfree(i2c_dev);
        return res;
 }
 
@@ -446,7 +446,6 @@ static int i2cdev_detach_adapter(struct i2c_adapter *adap)
        device_remove_file(i2c_dev->dev, &dev_attr_name);
        return_i2c_dev(i2c_dev);
        device_destroy(i2c_dev_class, MKDEV(I2C_MAJOR, adap->nr));
-       kfree(i2c_dev);
 
        pr_debug("i2c-dev: adapter [%s] unregistered\n", adap->name);
        return 0;
-
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