Skip to content

regulator: Fix teardown races, reference counting, and error handling

Lee Jones linux-gpio lkml stable 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest10 patches 5 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/10regulator: irq_helpers: Clear caller handle in regulator_irq_helper_cancel()drivers/regulator/irq_helpers.c+1 -11 reply
2/10regulator: arizona-ldo1: Avoid double gpiod_put() on enable GPIOdrivers/regulator/arizona-ldo1.c+0 -161 reply
3/10regulator: core: Flush delayed disable_work before releasing supply in regulator_unregister()drivers/regulator/core.c+2 -20 replies
4/10regulator: arizona-micsupp: Cancel check_cp_work on device teardowndrivers/regulator/arizona-micsupp.c+5 -11 reply
5/10regulator: core: Hold supply device reference until constraints are resolved in regulator_resolve_supply()drivers/regulator/core.c+9 -71 reply
6/10regulator: core: Use ktime_get_boottime() in set_machine_constraints()drivers/regulator/core.c+1 -10 replies
7/10regulator: bq257xx: Propagate GPIO error in bq257xx_reg_dt_parse_gpio()drivers/regulator/bq257xx-regulator.c+12 -80 replies
8/10regulator: tps6594-regulator: Fix LDO4 n_voltages in tps6594_ldo_regsdrivers/regulator/tps6594-regulator.c+1 -10 replies
9/10regulator: max8907: Avoid NULL idata dereference in max8907_regulator_probe()drivers/regulator/max8907-regulator.c+2 -10 replies
10/10regulator: rt6190: Check pm_runtime_resume_and_get() return value in rt6190_out_enable()drivers/regulator/rt6190-regulator.c+3 -10 replies

Reviews trailers per patch

3 of 10 patches have a Reviewed-by or Acked-by.

PatchMatti VaittinenCharles Keepax
1/10R-b
2/10R-b
3/10
4/10R-b
5/10
6/10
7/10
8/10
9/10
10/10

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/10] regulator: Fix teardown races, reference counting, and error handling

These issues were reported by Sashiko.

This series addresses ten bugs across the regulator core and regulator drivers:

- Clear the caller's handle pointer (*handle = NULL) in regulator_irq_helper_cancel() instead of assigning NULL to the local variable.
- Remove the redundant arizona_ldo1_remove() callback that caused a premature and double gpiod_put() on config.ena_gpiod (whose lifetime is owned by the regulator core).
- Flush rdev->disable_work with flush_delayed_work() before releasing rdev->supply in regulator_unregister().
- Cancel micsupp->check_cp_work on device teardown in arizona-micsupp using devm_work_autocancel().
- Take a dedicated device reference for rdev->supply in set_supply() and retain the local lookup reference throughout regulator_resolve_supply().
- Initialise rdev->last_off with ktime_get_boottime() in set_machine_constraints() to match _regulator_do_enable() and _regulator_do_disable().
- Propagate GPIO lookup errors (such as -EPROBE_DEFER) from bq257xx_reg_dt_parse_gpio() instead of leaving an ERR_PTR in pdata->otg_en_gpio.
- Fix the LDO4 n_voltages count in tps6594-regulator so selectors 0x3f through 0x74 are reachable.
- Guard against a NULL idata pointer for BBAT, SDBY, and VRTC in max8907_regulator_probe().
- Check the pm_runtime_resume_and_get() return value in rt6190_out_enable().

Cc "André Draszik" <[email protected]>
Cc Andy Shevchenko <[email protected]>
Cc Bartosz Golaszewski <[email protected]>
Cc Charles Keepax <[email protected]>
Cc ChiYuan Huang <[email protected]>
Cc Chris Morgan <[email protected]>
Cc Douglas Anderson <[email protected]>
Cc Eduardo Candelaria <[email protected]>
Cc Esteban Blanc <[email protected]>
Cc Graeme Gregory <[email protected]>
Cc Gyungoh Yoo <[email protected]>
Cc Jerome Neanne <[email protected]>
Cc Jiale Yao <[email protected]>
Cc Kuninori Morimoto <[email protected]>
Cc Laxman Dewangan <[email protected]>
Cc Liam Girdwood <[email protected]>
Cc Linus Walleij <[email protected]>
Cc Mal Nadar <[email protected]>
Cc Mark Brown <[email protected]>
Cc Matti Vaittinen <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Uday Khare <[email protected]>
Cc Wentao Liang <[email protected]>

Lee Jones (10):
regulator: irq_helpers: Clear caller handle in
regulator_irq_helper_cancel()
regulator: arizona-ldo1: Avoid double gpiod_put() on enable GPIO
regulator: core: Flush delayed disable_work before releasing supply in
regulator_unregister()
regulator: arizona-micsupp: Cancel check_cp_work on device teardown
regulator: core: Hold supply device reference until constraints are
resolved in regulator_resolve_supply()
regulator: core: Use ktime_get_boottime() in set_machine_constraints()
regulator: bq257xx: Propagate GPIO error in

    bq257xx_reg_dt_parse_gpio()
  regulator: tps6594-regulator: Fix LDO4 n_voltages in tps6594_ldo_regs
  regulator: max8907: Avoid NULL idata dereference in
    max8907_regulator_probe()
  regulator: rt6190: Check pm_runtime_resume_and_get() return value in
    rt6190_out_enable()
 drivers/regulator/arizona-ldo1.c      | 16 ----------------
 drivers/regulator/arizona-micsupp.c   |  6 +++++-
 drivers/regulator/bq257xx-regulator.c | 20 ++++++++++++--------
 drivers/regulator/core.c              | 22 ++++++++++++----------
 drivers/regulator/irq_helpers.c       |  2 +-
 drivers/regulator/max8907-regulator.c |  3 ++-
 drivers/regulator/rt6190-regulator.c  |  4 +++-
 drivers/regulator/tps6594-regulator.c |  2 +-
 8 files changed, 36 insertions(+), 39 deletions(-)

base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4

Signature · 1 line
2.56.0.385.gac671c819a-goog