]> git.karo-electronics.de Git - linux-beck.git/commitdiff
mfd: Convert WM8400 to devm_kzalloc()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Sat, 3 Dec 2011 21:43:04 +0000 (21:43 +0000)
committerSamuel Ortiz <sameo@linux.intel.com>
Sun, 8 Jan 2012 23:37:39 +0000 (00:37 +0100)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
drivers/mfd/wm8400-core.c

index 62b4626f4561029102ece804a7de96708186b2cb..2204893444a6ca6a4f2a245023169e1ff9e69379 100644 (file)
@@ -344,7 +344,7 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
        struct wm8400 *wm8400;
        int ret;
 
-       wm8400 = kzalloc(sizeof(struct wm8400), GFP_KERNEL);
+       wm8400 = devm_kzalloc(&i2c->dev, sizeof(struct wm8400), GFP_KERNEL);
        if (wm8400 == NULL) {
                ret = -ENOMEM;
                goto err;
@@ -353,7 +353,7 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
        wm8400->regmap = regmap_init_i2c(i2c, &wm8400_regmap_config);
        if (IS_ERR(wm8400->regmap)) {
                ret = PTR_ERR(wm8400->regmap);
-               goto struct_err;
+               goto err;
        }
 
        wm8400->dev = &i2c->dev;
@@ -367,8 +367,6 @@ static int wm8400_i2c_probe(struct i2c_client *i2c,
 
 map_err:
        regmap_exit(wm8400->regmap);
-struct_err:
-       kfree(wm8400);
 err:
        return ret;
 }
@@ -379,7 +377,6 @@ static int wm8400_i2c_remove(struct i2c_client *i2c)
 
        wm8400_release(wm8400);
        regmap_exit(wm8400->regmap);
-       kfree(wm8400);
 
        return 0;
 }