diff options
author | Jingoo Han <jg1.han@samsung.com> | 2013-12-17 02:01:41 -0500 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2014-01-04 16:11:24 -0500 |
commit | cf9557d1f4069129e85dc4eef9dc8d4371152ad8 (patch) | |
tree | 5c9277b1531e13ed1556896057ff0858af2b7883 /drivers/i2c | |
parent | a8763f33c55b74c26e4532e1893d2dcf6d038abe (diff) |
i2c: viperboard: Use devm_kzalloc() functions
Use devm_kzalloc() functions to make cleanup paths simpler.
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Acked-by: Lars Poeschel <poeschel@lemonage.de>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-viperboard.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c index c68450cd8d5f..6976e1ce3a65 100644 --- a/drivers/i2c/busses/i2c-viperboard.c +++ b/drivers/i2c/busses/i2c-viperboard.c | |||
@@ -367,7 +367,7 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) | |||
367 | int ret; | 367 | int ret; |
368 | int pipe; | 368 | int pipe; |
369 | 369 | ||
370 | vb_i2c = kzalloc(sizeof(*vb_i2c), GFP_KERNEL); | 370 | vb_i2c = devm_kzalloc(&pdev->dev, sizeof(*vb_i2c), GFP_KERNEL); |
371 | if (vb_i2c == NULL) | 371 | if (vb_i2c == NULL) |
372 | return -ENOMEM; | 372 | return -ENOMEM; |
373 | 373 | ||
@@ -394,14 +394,12 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) | |||
394 | if (ret != 1) { | 394 | if (ret != 1) { |
395 | dev_err(&pdev->dev, | 395 | dev_err(&pdev->dev, |
396 | "failure setting i2c_bus_freq to %d\n", i2c_bus_freq); | 396 | "failure setting i2c_bus_freq to %d\n", i2c_bus_freq); |
397 | ret = -EIO; | 397 | return -EIO; |
398 | goto error; | ||
399 | } | 398 | } |
400 | } else { | 399 | } else { |
401 | dev_err(&pdev->dev, | 400 | dev_err(&pdev->dev, |
402 | "invalid i2c_bus_freq setting:%d\n", i2c_bus_freq); | 401 | "invalid i2c_bus_freq setting:%d\n", i2c_bus_freq); |
403 | ret = -EIO; | 402 | return -EIO; |
404 | goto error; | ||
405 | } | 403 | } |
406 | 404 | ||
407 | vb_i2c->i2c.dev.parent = &pdev->dev; | 405 | vb_i2c->i2c.dev.parent = &pdev->dev; |
@@ -412,10 +410,6 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) | |||
412 | platform_set_drvdata(pdev, vb_i2c); | 410 | platform_set_drvdata(pdev, vb_i2c); |
413 | 411 | ||
414 | return 0; | 412 | return 0; |
415 | |||
416 | error: | ||
417 | kfree(vb_i2c); | ||
418 | return ret; | ||
419 | } | 413 | } |
420 | 414 | ||
421 | static int vprbrd_i2c_remove(struct platform_device *pdev) | 415 | static int vprbrd_i2c_remove(struct platform_device *pdev) |