Skip to content

Commit

Permalink
regulator: irq_helpers: duplicate IRQ name
Browse files Browse the repository at this point in the history
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 <mazziesaccount@gmail.com>
Link: https://msgid.link/r/ZhJMuUYwaZbBXFGP@drtxq0yyyyyyyyyyyyydy-3.rev.dnainternet.fi
Signed-off-by: Mark Brown <broonie@kernel.org>
  • Loading branch information
Matti Vaittinen authored and Mark Brown committed Apr 8, 2024
1 parent fec50db commit 7ab681d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/regulator/irq_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 7ab681d

Please sign in to comment.