Skip to content

Commit

Permalink
mfd: cros_ec: Use devm_kzalloc for private data
Browse files Browse the repository at this point in the history
Use dev_kzmalloc, remove .release entry point.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
Signed-off-by: Lee Jones <lee.jones@linaro.org>
  • Loading branch information
gwendalcr authored and Lee Jones committed Jun 4, 2018
1 parent 4e93a65 commit 3aa2177
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions drivers/mfd/cros_ec_dev.c
Original file line number Diff line number Diff line change
Expand Up @@ -262,12 +262,7 @@ static const struct file_operations fops = {
#endif
};

static void __remove(struct device *dev)
{
struct cros_ec_dev *ec = container_of(dev, struct cros_ec_dev,
class_dev);
kfree(ec);
}
static void __remove(struct device *dev) { }

static void cros_ec_sensors_register(struct cros_ec_dev *ec)
{
Expand Down Expand Up @@ -392,7 +387,7 @@ static int ec_device_probe(struct platform_device *pdev)
int retval = -ENOMEM;
struct device *dev = &pdev->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)
return retval;
Expand All @@ -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.class = &cros_class;
ec->class_dev.parent = dev;
ec->class_dev.release = __remove;

retval = dev_set_name(&ec->class_dev, "%s", ec_platform->ec_name);
if (retval) {
Expand Down

0 comments on commit 3aa2177

Please sign in to comment.