aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/wm1250-ev1.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/wm1250-ev1.c')
-rw-r--r--sound/soc/codecs/wm1250-ev1.c10
1 files changed, 3 insertions, 7 deletions
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)
116 if (!pdata) 116 if (!pdata)
117 return 0; 117 return 0;
118 118
119 wm1250 = kzalloc(sizeof(*wm1250), GFP_KERNEL); 119 wm1250 = devm_kzalloc(&i2c->dev, sizeof(*wm1250), GFP_KERNEL);
120 if (!wm1250) { 120 if (!wm1250) {
121 dev_err(&i2c->dev, "Unable to allocate private data\n"); 121 dev_err(&i2c->dev, "Unable to allocate private data\n");
122 ret = -ENOMEM; 122 ret = -ENOMEM;
@@ -134,15 +134,13 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c)
134 ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); 134 ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios));
135 if (ret != 0) { 135 if (ret != 0) {
136 dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret); 136 dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret);
137 goto err_alloc; 137 goto err;
138 } 138 }
139 139
140 dev_set_drvdata(&i2c->dev, wm1250); 140 dev_set_drvdata(&i2c->dev, wm1250);
141 141
142 return ret; 142 return ret;
143 143
144err_alloc:
145 kfree(wm1250);
146err: 144err:
147 return ret; 145 return ret;
148} 146}
@@ -151,10 +149,8 @@ static void wm1250_ev1_free(struct i2c_client *i2c)
151{ 149{
152 struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev); 150 struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev);
153 151
154 if (wm1250) { 152 if (wm1250)
155 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); 153 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios));
156 kfree(wm1250);
157 }
158} 154}
159 155
160static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, 156static int __devinit wm1250_ev1_probe(struct i2c_client *i2c,