Commit a81b82c0 authored by Mark Brown's avatar Mark Brown

ASoC: Use devm_kzalloc() in wm5100

Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 878042d1
...@@ -2607,7 +2607,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ...@@ -2607,7 +2607,8 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
unsigned int reg; unsigned int reg;
int ret, i; int ret, i;
wm5100 = kzalloc(sizeof(struct wm5100_priv), GFP_KERNEL); wm5100 = devm_kzalloc(&i2c->dev, sizeof(struct wm5100_priv),
GFP_KERNEL);
if (wm5100 == NULL) if (wm5100 == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -2616,7 +2617,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ...@@ -2616,7 +2617,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
ret = PTR_ERR(wm5100->regmap); ret = PTR_ERR(wm5100->regmap);
dev_err(&i2c->dev, "Failed to allocate register map: %d\n", dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
ret); ret);
goto err_alloc; goto err;
} }
for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++) for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++)
...@@ -2774,8 +2775,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, ...@@ -2774,8 +2775,7 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
wm5100->core_supplies); wm5100->core_supplies);
err_regmap: err_regmap:
regmap_exit(wm5100->regmap); regmap_exit(wm5100->regmap);
err_alloc: err:
kfree(wm5100);
return ret; return ret;
} }
...@@ -2799,7 +2799,6 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client) ...@@ -2799,7 +2799,6 @@ static __devexit int wm5100_i2c_remove(struct i2c_client *client)
regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies), regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
wm5100->core_supplies); wm5100->core_supplies);
regmap_exit(wm5100->regmap); regmap_exit(wm5100->regmap);
kfree(wm5100);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment