@@ -873,7 +873,7 @@ stu300_probe(struct platform_device *pdev)
int ret = 0;
char clk_name[] = "I2C0";
- dev = kzalloc(sizeof(struct stu300_dev), GFP_KERNEL);
+ dev = devm_kzalloc(&pdev->dev, sizeof(struct stu300_dev), GFP_KERNEL);
if (!dev) {
dev_err(&pdev->dev, "could not allocate device struct\n");
ret = -ENOMEM;
@@ -971,7 +971,6 @@ stu300_probe(struct platform_device *pdev)
err_no_resource:
clk_put(dev->clk);
err_no_clk:
- kfree(dev);
err_no_devmem:
dev_err(&pdev->dev, "failed to add " NAME " adapter: %d\n",
pdev->id);
@@ -1020,7 +1019,6 @@ stu300_remove(struct platform_device *pdev)
clk_unprepare(dev->clk);
clk_put(dev->clk);
platform_set_drvdata(pdev, NULL);
- kfree(dev);
return 0;
}