lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7ckcqck23wdwi2plotdl2rat4mb6ve4cl33jljkdro3h32h5pc@2k3fdxwa267p>
Date: Fri, 09 Jan 2026 14:54:12 +0000
From: Sean Nyekjaer <sean@...nix.com>
To: Marek Vasut <marex@...ladev.com>
Cc: linux-kernel@...r.kernel.org, Lee Jones <lee@...nel.org>, Pascal PAILLET-LME <p.paillet@...com>, Paul Cercueil <paul@...pouillou.net>, kernel@...electronics.com
Subject: Re: [PATCH] mfd: stpmic1: Attempt system shutdown twice in case PMIC is confused

On Fri, Jan 09, 2026 at 05:12:09AM +0100, Marek Vasut wrote:
> Attempt to shut down again, in case the first attempt failed.
> The STPMIC1 might get confused and the first regmap_update_bits()
> returns with -ETIMEDOUT / -110 . If that or similar transient
> failure occurs, try to shut down again. If the second attempt
> fails, there is some bigger problem, report it to user.

I don't think I have ever seen my devices fail to shutdown.
Have you ever seen the second call fail?

> 
> Fixes: 6e9df38f359a ("mfd: stpmic1: Add PMIC poweroff via sys-off handler")
> Signed-off-by: Marek Vasut <marex@...ladev.com>
Reviewed-by: Sean Nyekjaer <sean@...nix.com>
> ---
> Cc: Lee Jones <lee@...nel.org>
> Cc: Pascal PAILLET-LME <p.paillet@...com>
> Cc: Paul Cercueil <paul@...pouillou.net>
> Cc: Sean Nyekjaer <sean@...nix.com>
> Cc: kernel@...electronics.com
> ---
>  drivers/mfd/stpmic1.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/mfd/stpmic1.c b/drivers/mfd/stpmic1.c
> index 081827bc05961..9ef4049d7db10 100644
> --- a/drivers/mfd/stpmic1.c
> +++ b/drivers/mfd/stpmic1.c
> @@ -121,9 +121,23 @@ static const struct regmap_irq_chip stpmic1_regmap_irq_chip = {
>  static int stpmic1_power_off(struct sys_off_data *data)
>  {
>  	struct stpmic1 *ddata = data->cb_data;
> +	int ret;
> +
> +	ret = regmap_update_bits(ddata->regmap, MAIN_CR, SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF);
> +	if (!ret)
> +		return NOTIFY_DONE;
> +
> +	/*
> +	 * Attempt to shut down again, in case the first attempt failed.
> +	 * The STPMIC1 might get confused and the first regmap_update_bits()
> +	 * returns with -ETIMEDOUT / -110 . If that or similar transient
> +	 * failure occurs, try to shut down again. If the second attempt
> +	 * fails, there is some bigger problem, report it to user.
> +	 */
> +	ret = regmap_update_bits(ddata->regmap, MAIN_CR, SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF);
> +	if (ret)
> +		dev_err(ddata->dev, "Failed to access PMIC I2C bus (%d)\n", ret);
> 
> -	regmap_update_bits(ddata->regmap, MAIN_CR,
> -			   SOFTWARE_SWITCH_OFF, SOFTWARE_SWITCH_OFF);
> 
>  	return NOTIFY_DONE;
>  }
> --
> 2.51.0
> 


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ