aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ab3100-otp.c
diff options
context:
space:
mode:
authorLee Jones <lee.jones@linaro.org>2013-05-23 11:25:04 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2013-06-13 06:11:39 -0400
commit5feac05dd4a403b12e8e0212006bad5c52e36fba (patch)
treedc549b863ca6926870bbd54cb8372e3be138ad8d /drivers/mfd/ab3100-otp.c
parentb3fff1770a33abb1905eae2baa8dffd48e5913ae (diff)
mfd: ab3100-otp: Convert to managed resources for allocating memory
Signed-off-by: Lee Jones <lee.jones@linaro.org> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/mfd/ab3100-otp.c')
-rw-r--r--drivers/mfd/ab3100-otp.c14
1 files changed, 5 insertions, 9 deletions
diff --git a/drivers/mfd/ab3100-otp.c b/drivers/mfd/ab3100-otp.c
index d7ce016029fa..c9af16cc7310 100644
--- a/drivers/mfd/ab3100-otp.c
+++ b/drivers/mfd/ab3100-otp.c
@@ -187,7 +187,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev)
187 int err = 0; 187 int err = 0;
188 int i; 188 int i;
189 189
190 otp = kzalloc(sizeof(struct ab3100_otp), GFP_KERNEL); 190 otp = devm_kzalloc(&pdev->dev, sizeof(struct ab3100_otp), GFP_KERNEL);
191 if (!otp) { 191 if (!otp) {
192 dev_err(&pdev->dev, "could not allocate AB3100 OTP device\n"); 192 dev_err(&pdev->dev, "could not allocate AB3100 OTP device\n");
193 return -ENOMEM; 193 return -ENOMEM;
@@ -199,7 +199,7 @@ static int __init ab3100_otp_probe(struct platform_device *pdev)
199 199
200 err = ab3100_otp_read(otp); 200 err = ab3100_otp_read(otp);
201 if (err) 201 if (err)
202 goto err_otp_read; 202 return err;
203 203
204 dev_info(&pdev->dev, "AB3100 OTP readout registered\n"); 204 dev_info(&pdev->dev, "AB3100 OTP readout registered\n");
205 205
@@ -208,22 +208,19 @@ static int __init ab3100_otp_probe(struct platform_device *pdev)
208 err = device_create_file(&pdev->dev, 208 err = device_create_file(&pdev->dev,
209 &ab3100_otp_attrs[i]); 209 &ab3100_otp_attrs[i]);
210 if (err) 210 if (err)
211 goto err_create_file; 211 goto err;
212 } 212 }
213 213
214 /* debugfs entries */ 214 /* debugfs entries */
215 err = ab3100_otp_init_debugfs(&pdev->dev, otp); 215 err = ab3100_otp_init_debugfs(&pdev->dev, otp);
216 if (err) 216 if (err)
217 goto err_init_debugfs; 217 goto err;
218 218
219 return 0; 219 return 0;
220 220
221err_init_debugfs: 221err:
222err_create_file:
223 while (--i >= 0) 222 while (--i >= 0)
224 device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]); 223 device_remove_file(&pdev->dev, &ab3100_otp_attrs[i]);
225err_otp_read:
226 kfree(otp);
227 return err; 224 return err;
228} 225}
229 226
@@ -236,7 +233,6 @@ static int __exit ab3100_otp_remove(struct platform_device *pdev)
236 device_remove_file(&pdev->dev, 233 device_remove_file(&pdev->dev,
237 &ab3100_otp_attrs[i]); 234 &ab3100_otp_attrs[i]);
238 ab3100_otp_exit_debugfs(otp); 235 ab3100_otp_exit_debugfs(otp);
239 kfree(otp);
240 return 0; 236 return 0;
241} 237}
242 238