Commit 3aa2177e authored by Gwendal Grignou's avatar Gwendal Grignou Committed by Lee Jones

mfd: cros_ec: Use devm_kzalloc for private data

Use dev_kzmalloc, remove .release entry point.
Signed-off-by: default avatarGwendal Grignou <gwendal@chromium.org>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 4e93a658
...@@ -262,12 +262,7 @@ static const struct file_operations fops = { ...@@ -262,12 +262,7 @@ static const struct file_operations fops = {
#endif #endif
}; };
static void __remove(struct device *dev) static void __remove(struct device *dev) { }
{
struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev,
class_dev);
kfree(ec);
}
static void cros_ec_sensors_register(struct cros_ec_dev *ec) static void cros_ec_sensors_register(struct cros_ec_dev *ec)
{ {
...@@ -392,7 +387,7 @@ static int ec_device_probe(struct platform_device *pdev) ...@@ -392,7 +387,7 @@ static int ec_device_probe(struct platform_device *pdev)
int retval = -ENOMEM; int retval = -ENOMEM;
struct device *dev = &pdev->dev; struct device *dev = &pdev->dev;
struct cros_ec_platform *ec_platform = dev_get_platdata(dev); struct cros_ec_platform *ec_platform = dev_get_platdata(dev);
struct cros_ec_dev *ec = kzalloc(sizeof(*ec), GFP_KERNEL); struct cros_ec_dev *ec = devm_kzalloc(dev, sizeof(*ec), GFP_KERNEL);
if (!ec) if (!ec)
return retval; return retval;
...@@ -414,7 +409,6 @@ static int ec_device_probe(struct platform_device *pdev) ...@@ -414,7 +409,6 @@ static int ec_device_probe(struct platform_device *pdev)
ec->class_dev.devt = MKDEV(ec_major, pdev->id); ec->class_dev.devt = MKDEV(ec_major, pdev->id);
ec->class_dev.class = &cros_class; ec->class_dev.class = &cros_class;
ec->class_dev.parent = dev; ec->class_dev.parent = dev;
ec->class_dev.release = __remove;
retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name); retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name);
if (retval) { if (retval) {
......
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