aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Vaittinen <[email protected]>2024-04-07 10:35:21 +0300
committerMark Brown <[email protected]>2024-04-08 13:58:57 +0100
commit7ab681ddedd4b6dd2b047c74af95221c5f827e1d (patch)
tree97be277558ef5a62a458561531c75d21c1464476
parentfec50db7033ea478773b159e0e2efb135270e3b7 (diff)
regulator: irq_helpers: duplicate IRQ name
The regulator IRQ helper requires caller to provide pointer to IRQ name which is kept in memory by caller. All other data passed to the helper in the regulator_irq_desc structure is copied. This can cause some confusion and unnecessary complexity. Make the regulator_irq_helper() to copy also the provided IRQ name information so caller can discard the name after the call to regulator_irq_helper() completes. Signed-off-by: Matti Vaittinen <[email protected]> Link: https://msgid.link/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
-rw-r--r--drivers/regulator/irq_helpers.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/regulator/irq_helpers.c b/drivers/regulator/irq_helpers.c
index fe7ae0f3f46a..5ab1a0befe12 100644
--- a/drivers/regulator/irq_helpers.c
+++ b/drivers/regulator/irq_helpers.c
@@ -352,6 +352,9 @@ void *regulator_irq_helper(struct device *dev,
h->irq = irq;
h->desc = *d;
+ h->desc.name = devm_kstrdup(dev, d->name, GFP_KERNEL);
+ if (!h->desc.name)
+ return ERR_PTR(-ENOMEM);
ret = init_rdev_state(dev, h, rdev, common_errs, per_rdev_errs,
rdev_amount);