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] [day] [month] [year] [list]
Message-ID: <CAHp75Vcyr2gQ_Z7BV5nEJCSb1taWnBOfCfTWMQtMG-65Z+D0Dg@mail.gmail.com>
Date: Tue, 26 Aug 2025 11:05:35 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc: Jonathan Cameron <jic23@...nel.org>, David Lechner <dlechner@...libre.com>, 
	Nuno Sá <nuno.sa@...log.com>, 
	Andy Shevchenko <andy@...nel.org>, Maxime Coquelin <mcoquelin.stm32@...il.com>, 
	Alexandre Torgue <alexandre.torgue@...s.st.com>, linux-iio@...r.kernel.org, 
	linux-stm32@...md-mailman.stormreply.com, 
	linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org, 
	Uwe Kleine-König <u.kleine-koenig@...libre.com>
Subject: Re: [PATCH v4 1/1] iio: dac: Remove redundant pm_runtime_mark_last_busy()
 calls

On Mon, Aug 25, 2025 at 11:53 PM Sakari Ailus
<sakari.ailus@...ux.intel.com> wrote:
>
> pm_runtime_put_autosuspend(), pm_runtime_put_sync_autosuspend(),
> pm_runtime_autosuspend() and pm_request_autosuspend() now include a call
> to pm_runtime_mark_last_busy(). Remove the now-reduntant explicit call to
> pm_runtime_mark_last_busy().
>
> Also clean up error handling in stm32_dac_set_enable_state().

TL;DR: I think this change makes it harder to follow (due to complex
conditional).

...

>         ret = regmap_update_bits(dac->common->regmap, STM32_DAC_CR, msk, en);
>         mutex_unlock(&dac->lock);
> -       if (ret < 0) {
> +       if (ret) {
>                 dev_err(&indio_dev->dev, "%s failed\n", str_enable_disable(en));
> -               goto err_put_pm;
> +               goto err_pm_put;

This is one time use for the label and we know that ret is set here.

Just

  if (enable)
    pm_runtime_put_autosuspend(dev);
  return ret;

should work.

>         }

...

> -       if (!enable) {
> -               pm_runtime_mark_last_busy(dev);
> -               pm_runtime_put_autosuspend(dev);
> -       }
> -
> -       return 0;
> -
> -err_put_pm:
> -       if (enable) {
> -               pm_runtime_mark_last_busy(dev);
> +err_pm_put:
> +       if (!enable || (enable && ret))
>                 pm_runtime_put_autosuspend(dev);
> -       }
>
>         return ret;


And here is as simple as

if (!enable)
  pm_runtime_put_autosuspend(dev);

return 0;

and remove the unneeded label altogether with the error path.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ