Commit 410e7088 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Greg Kroah-Hartman

devres: Pass unique name of the resource to devm_add_action_or_reset()

All the same as it's done in the commit e32c80bbd2f9 ("devres:
Pass unique name of the resource to devm_add_action()") applies
to the devm_add_action_or_reset(), which this change makes real.
This helps with debug resource management.
Reported-and-tested-by: default avatarMirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230313113100.59643-1-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0433686c
...@@ -250,17 +250,19 @@ int __devm_add_action(struct device *dev, void (*action)(void *), void *data, co ...@@ -250,17 +250,19 @@ int __devm_add_action(struct device *dev, void (*action)(void *), void *data, co
#define devm_add_action(release, action, data) \ #define devm_add_action(release, action, data) \
__devm_add_action(release, action, data, #action) __devm_add_action(release, action, data, #action)
static inline int devm_add_action_or_reset(struct device *dev, static inline int __devm_add_action_or_reset(struct device *dev, void (*action)(void *),
void (*action)(void *), void *data) void *data, const char *name)
{ {
int ret; int ret;
ret = devm_add_action(dev, action, data); ret = __devm_add_action(dev, action, data, name);
if (ret) if (ret)
action(data); action(data);
return ret; return ret;
} }
#define devm_add_action_or_reset(release, action, data) \
__devm_add_action_or_reset(release, action, data, #action)
/** /**
* devm_alloc_percpu - Resource-managed alloc_percpu * devm_alloc_percpu - Resource-managed alloc_percpu
......
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