@@ -640,7 +640,7 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
struct cpm_i2c *cpm;
const u32 *data;
- cpm = kzalloc(sizeof(struct cpm_i2c), GFP_KERNEL);
+ cpm = devm_kzalloc(&ofdev->dev, sizeof(struct cpm_i2c), GFP_KERNEL);
if (!cpm)
return -ENOMEM;
@@ -683,7 +683,6 @@ out_shut:
cpm_i2c_shutdown(cpm);
out_free:
dev_set_drvdata(&ofdev->dev, NULL);
- kfree(cpm);
return result;
}
@@ -697,7 +696,6 @@ static int __devexit cpm_i2c_remove(struct platform_device *ofdev)
cpm_i2c_shutdown(cpm);
dev_set_drvdata(&ofdev->dev, NULL);
- kfree(cpm);
return 0;
}