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: <CAJZ5v0goaS5O1_Hds2DnWsw_G-Dg4fU9NEY0=chyn5ECTcBmDw@mail.gmail.com>
Date:   Mon, 13 Mar 2023 19:43:22 +0100
From:   "Rafael J. Wysocki" <rafael@...nel.org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc:     linux-kernel@...r.kernel.org, rafael@...nel.org,
        Len Brown <lenb@...nel.org>, linux-acpi@...r.kernel.org
Subject: Re: [PATCH 02/36] ACPI: LPIT: move to use bus_get_dev_root()

On Mon, Mar 13, 2023 at 7:29 PM Greg Kroah-Hartman
<gregkh@...uxfoundation.org> wrote:
>
> Direct access to the struct bus_type dev_root pointer is going away soon
> so replace that with a call to bus_get_dev_root() instead, which is what
> it is there for.
>
> Cc: "Rafael J. Wysocki" <rafael@...nel.org>
> Cc: Len Brown <lenb@...nel.org>
> Cc: linux-acpi@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
> Note, this is a patch that is a prepatory cleanup as part of a larger
> series of patches that is working on resolving some old driver core
> design mistakes.  It will build and apply cleanly on top of 6.3-rc2 on
> its own, but I'd prefer if I could take it through my driver-core tree
> so that the driver core changes can be taken through there for 6.4-rc1.
>
>  drivers/acpi/acpi_lpit.c | 17 +++++++++++------
>  1 file changed, 11 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
> index 3843d2576d3f..73b5c4800150 100644
> --- a/drivers/acpi/acpi_lpit.c
> +++ b/drivers/acpi/acpi_lpit.c
> @@ -98,6 +98,8 @@ EXPORT_SYMBOL_GPL(lpit_read_residency_count_address);
>  static void lpit_update_residency(struct lpit_residency_info *info,
>                                  struct acpi_lpit_native *lpit_native)
>  {
> +       struct device *dev_root = bus_get_dev_root(&cpu_subsys);
> +

This can return here right away if dev_root is NULL, because it will
not do anything useful in that case anyway.

>         info->frequency = lpit_native->counter_frequency ?
>                                 lpit_native->counter_frequency : tsc_khz * 1000;
>         if (!info->frequency)
> @@ -111,15 +113,18 @@ static void lpit_update_residency(struct lpit_residency_info *info,
>                         return;
>
>                 /* Silently fail, if cpuidle attribute group is not present */
> -               sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
> -                                       &dev_attr_low_power_idle_system_residency_us.attr,
> -                                       "cpuidle");
> +               if (dev_root)
> +                       sysfs_add_file_to_group(&dev_root->kobj,
> +                                               &dev_attr_low_power_idle_system_residency_us.attr,
> +                                               "cpuidle");
>         } else if (info->gaddr.space_id == ACPI_ADR_SPACE_FIXED_HARDWARE) {
>                 /* Silently fail, if cpuidle attribute group is not present */
> -               sysfs_add_file_to_group(&cpu_subsys.dev_root->kobj,
> -                                       &dev_attr_low_power_idle_cpu_residency_us.attr,
> -                                       "cpuidle");
> +               if (dev_root)
> +                       sysfs_add_file_to_group(&dev_root->kobj,
> +                                               &dev_attr_low_power_idle_cpu_residency_us.attr,
> +                                               "cpuidle");
>         }
> +       put_device(dev_root);
>  }
>
>  static void lpit_process(u64 begin, u64 end)
> --
> 2.39.2
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ