From: Mark Brown Date: Sun, 27 Nov 2011 15:56:55 +0000 (+0000) Subject: ASoC: Convert wm1250-ev1 driver to use devm_kzalloc() X-Git-Tag: MMI-PSA29.97-13-9~16612^2~390 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5fe803f56ad41cf008399f71ee48280f0cf9732b;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git ASoC: Convert wm1250-ev1 driver to use devm_kzalloc() Signed-off-by: Mark Brown --- diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c index cd0ec0fd1dba..aefb4f89be0e 100644 --- a/sound/soc/codecs/wm1250-ev1.c +++ b/sound/soc/codecs/wm1250-ev1.c @@ -116,7 +116,7 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c) if (!pdata) return 0; - wm1250 = kzalloc(sizeof(*wm1250), GFP_KERNEL); + wm1250 = devm_kzalloc(&i2c->dev, sizeof(*wm1250), GFP_KERNEL); if (!wm1250) { dev_err(&i2c->dev, "Unable to allocate private data\n"); ret = -ENOMEM; @@ -134,15 +134,13 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c) ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); if (ret != 0) { dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret); - goto err_alloc; + goto err; } dev_set_drvdata(&i2c->dev, wm1250); return ret; -err_alloc: - kfree(wm1250); err: return ret; } @@ -151,10 +149,8 @@ static void wm1250_ev1_free(struct i2c_client *i2c) { struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev); - if (wm1250) { + if (wm1250) gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); - kfree(wm1250); - } } static int __devinit wm1250_ev1_probe(struct i2c_client *i2c,