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: <CAHp75Vc-cd_-+qyd62tcJGdXh917AgZY5VB0ztXR3zwrGoMCRQ@mail.gmail.com>
Date:   Tue, 9 Aug 2022 11:39:53 +0200
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Marcus Folkesson <marcus.folkesson@...il.com>
Cc:     Kent Gustavsson <kent@...oris.se>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        linux-iio <linux-iio@...r.kernel.org>,
        devicetree <devicetree@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v5 4/9] iio: adc: mcp3911: use resource-managed version of iio_device_register

On Tue, Aug 9, 2022 at 9:32 AM Marcus Folkesson
<marcus.folkesson@...il.com> wrote:
>
> Keep using managed resources as much as possible.

...

> +static void mcp3911_cleanup_clock(void *_adc)
> +{
> +       struct mcp3911 *adc = _adc;
> +       clk_disable_unprepare(adc->clki);
> +}

You may rather switch to devm_clk_get_enabled() and drop this.

...

>                         dev_err(&adc->spi->dev,
>                                 "failed to get adc clk (%ld)\n",
>                                 PTR_ERR(adc->clki));
> -                       ret = PTR_ERR(adc->clki);
> -                       goto reg_disable;
> +                       return PTR_ERR(adc->clki);
>                 }
>         } else {
>                 ret = clk_prepare_enable(adc->clki);
>                 if (ret < 0) {
>                         dev_err(&adc->spi->dev,
>                                 "Failed to enable clki: %d\n", ret);
> -                       goto reg_disable;
> +                       return ret;
>                 }
> +
> +               ret = devm_add_action_or_reset(&spi->dev,
> +                               mcp3911_cleanup_clock, adc);
> +               if (ret)
> +                       return ret;
>         }

As per above.

-- 
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ