public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
  • * Re: [PATCH v3 1/3] iio: imu: inv_mpu6050: fix unbalanced regulator_disable calls, when probe fails
           [not found] ` <20260426112334.3938774-2-andrej.skvortzov@gmail.com>
           [not found]   ` <20260426154330.0a29236e@jic23-huawei>
    @ 2026-04-27  8:28   ` Andy Shevchenko
      1 sibling, 0 replies; 3+ messages in thread
    From: Andy Shevchenko @ 2026-04-27  8:28 UTC (permalink / raw)
      To: Andrey Skvortsov
      Cc: Jean-Baptiste Maneyrol, Jonathan Cameron, David Lechner,
    	Nuno Sá, Andy Shevchenko, linux-iio, linux-kernel,
    	Jonathan Marek, Brian Masney, Rob Herring
    
    On Sun, Apr 26, 2026 at 02:23:32PM +0300, Andrey Skvortsov wrote:
    > During a probe functions after all regulators are enabled, runtime pm
    > is enabled. Before probe function finishes, runtime pm triggers and
    > disables vddio regulator. When probe function fails after that,
    > inv_mpu_core_disable_regulator_action tries to disable already
    
    Please, use () when we refer to the functions or callbacks:
     — func()
     — .callback()
    
    > disabled by runtime pm vddio regulator causing following backtrace:
    
    PM
    
    >   inv-mpu6050-i2c 1-0068: trigger probe fail -19
    >   WARNING: drivers/regulator/core.c:3244 at _regulator_disable+0x2ac/0x600
    >   Call trace:
    >    _regulator_disable+0x2ac/0x600 (P)
    >    regulator_disable+0xac/0x148
    >    inv_mpu_core_disable_regulator_vddio_action+0x3c/0xb0 [inv_mpu6050]
    >    devm_action_release+0x4c/0x88
    >    release_nodes+0xd8/0x178
    >    devres_release_group+0x214/0x3c8
    >    i2c_device_probe+0x6fc/0x9b0
    >   ...
    >   inv-mpu6050-i2c 1-0068: Failed to disable vddio regulator: -5
    > 
    > vddio state is handled in two places: pm_runtime and
    > inv_mpu_core_disable_regulator_vddio_action devm action.
    > inv_mpu_core_disable_regulator_vddio_action has to check, whether
    > regulator is disabled by pm_runtime already. But this information is
    > available only after pm_runtime state is initialized by
    > pm_runtime_set_active during a probe. So
    > inv_mpu_core_disable_regulator_vddio_action has to be called only
    > after pm_runtime is properly initialized. To handle cases, when probe
    > fails before pm_runtime is enabled, explicitly disable regulators
    > in error paths.
    
    As per previous comments.
    
    ...
    
    > +	result = devm_add_action_or_reset(dev, inv_mpu_core_disable_regulator_action,
    > +					  st);
    
    I would go with a single line despite being long.
    
    
    > +	if (result)
    > +		return dev_err_probe(dev, result,
    > +				     "Failed to setup regulator cleanup action\n");
    
    -- 
    With Best Regards,
    Andy Shevchenko
    
    
    
    ^ permalink raw reply	[flat|nested] 3+ messages in thread

  • end of thread, other threads:[~2026-04-27  9:04 UTC | newest]
    
    Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20260426112334.3938774-1-andrej.skvortzov@gmail.com>
         [not found] ` <20260426112334.3938774-2-andrej.skvortzov@gmail.com>
         [not found]   ` <20260426154330.0a29236e@jic23-huawei>
    2026-04-26 20:25     ` [PATCH v3 1/3] iio: imu: inv_mpu6050: fix unbalanced regulator_disable calls, when probe fails Andrey Skvortsov
    2026-04-27  9:04       ` Jonathan Cameron
    2026-04-27  8:28   ` Andy Shevchenko
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox