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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAGb2v67Jd6qFS-zmD+Hm4BJHA+-kx0nAxvDovUwW=WwZTEGYeg@mail.gmail.com>
Date:   Tue, 23 Mar 2021 22:36:05 +0800
From:   Chen-Yu Tsai <wens@...e.org>
To:     matti.vaittinen@...rohmeurope.com
Cc:     Matti Vaittinen <mazziesaccount@...il.com>,
        Hans de Goede <hdegoede@...hat.com>,
        Sebastian Reichel <sre@...nel.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-kernel <linux-kernel@...r.kernel.org>,
        "open list:THERMAL" <linux-pm@...r.kernel.org>
Subject: Re: [PATCH v3 6/8] power: supply: Clean-up few drivers by using
 managed work init

Hi,

On Tue, Mar 23, 2021 at 9:58 PM Matti Vaittinen
<matti.vaittinen@...rohmeurope.com> wrote:
>
> Few drivers implement remove call-back only for ensuring a delayed
> work gets cancelled prior driver removal. Clean-up these by switching
> to use devm_delayed_work_autocancel() instead.
>
> This change is compile-tested only. All testing is appreciated.
>
> Signed-off-by: Matti Vaittinen <matti.vaittinen@...rohmeurope.com>
> Acked-by: Sebastian Reichel <sebastian.reichel@...labora.com>
> ---
> Changelog from RFCv2:
>  - RFC dropped. No functional changes.
>
>  drivers/power/supply/axp20x_usb_power.c      | 15 +++++----------
>  drivers/power/supply/bq24735-charger.c       | 18 ++++++------------
>  drivers/power/supply/ltc2941-battery-gauge.c | 20 +++++++-------------
>  drivers/power/supply/sbs-battery.c           | 16 +++++-----------
>  4 files changed, 23 insertions(+), 46 deletions(-)
>
> diff --git a/drivers/power/supply/axp20x_usb_power.c b/drivers/power/supply/axp20x_usb_power.c
> index 8933ae26c3d6..4259709e3491 100644
> --- a/drivers/power/supply/axp20x_usb_power.c
> +++ b/drivers/power/supply/axp20x_usb_power.c
> @@ -8,6 +8,7 @@
>
>  #include <linux/bitops.h>
>  #include <linux/device.h>
> +#include <linux/devm-helpers.h>
>  #include <linux/init.h>
>  #include <linux/interrupt.h>
>  #include <linux/kernel.h>
> @@ -646,21 +647,16 @@ static int axp20x_usb_power_probe(struct platform_device *pdev)
>                 }
>         }
>
> +       ret = devm_delayed_work_autocancel(&pdev->dev, &power->vbus_detect,
> +                                          axp20x_usb_power_poll_vbus);
> +       if (ret)
> +               return ret;

This doesn't look right. The IRQ is requested before this, and the delayed_work
struct is initialized even earlier, so you'd be re-initializing the struct,
with the work item potentially running or queued up already.


ChenYu

>         if (axp20x_usb_vbus_needs_polling(power))
>                 queue_delayed_work(system_power_efficient_wq, &power->vbus_detect, 0);
>
>         return 0;
>  }
>
> -static int axp20x_usb_power_remove(struct platform_device *pdev)
> -{
> -       struct axp20x_usb_power *power = platform_get_drvdata(pdev);
> -
> -       cancel_delayed_work_sync(&power->vbus_detect);
> -
> -       return 0;
> -}
> -
>  static const struct of_device_id axp20x_usb_power_match[] = {
>         {
>                 .compatible = "x-powers,axp202-usb-power-supply",
> @@ -680,7 +676,6 @@ MODULE_DEVICE_TABLE(of, axp20x_usb_power_match);
>
>  static struct platform_driver axp20x_usb_power_driver = {
>         .probe = axp20x_usb_power_probe,
> -       .remove = axp20x_usb_power_remove,
>         .driver = {
>                 .name           = DRVNAME,
>                 .of_match_table = axp20x_usb_power_match,

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ