diff options
Diffstat (limited to 'drivers/mfd/abx500-core.c')
| -rw-r--r-- | drivers/mfd/abx500-core.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/drivers/mfd/abx500-core.c b/drivers/mfd/abx500-core.c index 3b3b97ec32a..fe418995108 100644 --- a/drivers/mfd/abx500-core.c +++ b/drivers/mfd/abx500-core.c @@ -8,6 +8,7 @@ #include <linux/list.h> #include <linux/slab.h> #include <linux/err.h> +#include <linux/module.h> #include <linux/mfd/abx500.h> static LIST_HEAD(abx500_list); @@ -35,8 +36,10 @@ int abx500_register_ops(struct device *dev, struct abx500_ops *ops) { struct abx500_device_entry *dev_entry; - dev_entry = kzalloc(sizeof(struct abx500_device_entry), GFP_KERNEL); - if (IS_ERR(dev_entry)) { + dev_entry = devm_kzalloc(dev, + sizeof(struct abx500_device_entry), + GFP_KERNEL); + if (!dev_entry) { dev_err(dev, "register_ops kzalloc failed"); return -ENOMEM; } @@ -53,12 +56,8 @@ void abx500_remove_ops(struct device *dev) struct abx500_device_entry *dev_entry, *tmp; list_for_each_entry_safe(dev_entry, tmp, &abx500_list, list) - { - if (dev_entry->dev == dev) { + if (dev_entry->dev == dev) list_del(&dev_entry->list); - kfree(dev_entry); - } - } } EXPORT_SYMBOL(abx500_remove_ops); |
