diff options
-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) |