Commit cf9557d1 authored by Jingoo Han's avatar Jingoo Han Committed by Wolfram Sang

i2c: viperboard: Use devm_kzalloc() functions

Use devm_kzalloc() functions to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Acked-by: default avatarLars Poeschel <poeschel@lemonage.de>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent a8763f33
...@@ -367,7 +367,7 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) ...@@ -367,7 +367,7 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
int ret; int ret;
int pipe; 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) if (vb_i2c == NULL)
return -ENOMEM; return -ENOMEM;
...@@ -394,14 +394,12 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) ...@@ -394,14 +394,12 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
if (ret != 1) { if (ret != 1) {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"failure setting i2c_bus_freq to %d\n", i2c_bus_freq); "failure setting i2c_bus_freq to %d\n", i2c_bus_freq);
ret = -EIO; return -EIO;
goto error;
} }
} else { } else {
dev_err(&pdev->dev, dev_err(&pdev->dev,
"invalid i2c_bus_freq setting:%d\n", i2c_bus_freq); "invalid i2c_bus_freq setting:%d\n", i2c_bus_freq);
ret = -EIO; return -EIO;
goto error;
} }
vb_i2c->i2c.dev.parent = &pdev->dev; vb_i2c->i2c.dev.parent = &pdev->dev;
...@@ -412,10 +410,6 @@ static int vprbrd_i2c_probe(struct platform_device *pdev) ...@@ -412,10 +410,6 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
platform_set_drvdata(pdev, vb_i2c); platform_set_drvdata(pdev, vb_i2c);
return 0; return 0;
error:
kfree(vb_i2c);
return ret;
} }
static int vprbrd_i2c_remove(struct platform_device *pdev) static int vprbrd_i2c_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment