lkml.org 
[lkml]   [2018]   [May]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] cros_ec: Use devm_kzalloc for private data
Date
Use dev_kzmalloc, remove .release entry point.

Signed-off-by: Gwendal Grignou <gwendal@chromium.org>
---
drivers/mfd/cros_ec_dev.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/mfd/cros_ec_dev.c b/drivers/mfd/cros_ec_dev.c
index eafd06f62a3a..45d42511a3e5 100644
--- a/drivers/mfd/cros_ec_dev.c
+++ b/drivers/mfd/cros_ec_dev.c
@@ -262,13 +262,6 @@ 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 cros_ec_sensors_register(struct cros_ec_dev *ec)
{
/*
@@ -388,7 +381,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;
@@ -410,7 +403,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) {
--
2.17.0.441.gb46fe60e1d-goog
\
 
 \ /
  Last update: 2018-05-10 01:07    [W:0.079 / U:0.900 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site