summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJingoo Han <jg1.han@samsung.com>2013-12-17 16:01:41 +0900
committerWolfram Sang <wsa@the-dreams.de>2014-01-04 22:11:24 +0100
commitcf9557d1f4069129e85dc4eef9dc8d4371152ad8 (patch)
tree5c9277b1531e13ed1556896057ff0858af2b7883 /drivers/i2c
parenta8763f33c55b74c26e4532e1893d2dcf6d038abe (diff)
downloadop-kernel-dev-cf9557d1f4069129e85dc4eef9dc8d4371152ad8.zip
op-kernel-dev-cf9557d1f4069129e85dc4eef9dc8d4371152ad8.tar.gz
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.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
index c68450c..6976e1c 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)
int ret;
int pipe;
- vb_i2c = kzalloc(sizeof(*vb_i2c), GFP_KERNEL);
+ vb_i2c = devm_kzalloc(&pdev->dev, sizeof(*vb_i2c), GFP_KERNEL);
if (vb_i2c == NULL)
return -ENOMEM;
@@ -394,14 +394,12 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
if (ret != 1) {
dev_err(&pdev->dev,
"failure setting i2c_bus_freq to %d\n", i2c_bus_freq);
- ret = -EIO;
- goto error;
+ return -EIO;
}
} else {
dev_err(&pdev->dev,
"invalid i2c_bus_freq setting:%d\n", i2c_bus_freq);
- ret = -EIO;
- goto error;
+ return -EIO;
}
vb_i2c->i2c.dev.parent = &pdev->dev;
@@ -412,10 +410,6 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vb_i2c);
return 0;
-
-error:
- kfree(vb_i2c);
- return ret;
}
static int vprbrd_i2c_remove(struct platform_device *pdev)
OpenPOWER on IntegriCloud