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]
Date:   Fri, 25 Oct 2019 10:42:20 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Hans de Goede <hdegoede@...hat.com>
Cc:     "Rafael J . Wysocki" <rjw@...ysocki.net>,
        Len Brown <lenb@...nel.org>, Lee Jones <lee.jones@...aro.org>,
        Mika Westerberg <mika.westerberg@...ux.intel.com>,
        linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] ACPI / PMIC: Do not register handlers for unhandled
 OpRegions

On Thu, Oct 24, 2019 at 11:38:24PM +0200, Hans de Goede wrote:
> For some model PMIC's used on Intel boards we do not know how to
> handle the power or thermal opregions because we have no documentation.
> 
> For example in the intel_pmic_chtwc.c driver thermal_table_count is 0,
> which means that our PMIC_THERMAL_OPREGION_ID handler will always fail
> with AE_BAD_PARAMETER, in this case it is better to simply not register
> the handler at all.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>

> 
> Signed-off-by: Hans de Goede <hdegoede@...hat.com>
> ---
>  drivers/acpi/pmic/intel_pmic.c | 20 +++++++++++++-------
>  1 file changed, 13 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/acpi/pmic/intel_pmic.c b/drivers/acpi/pmic/intel_pmic.c
> index 452041398b34..a371f273f99d 100644
> --- a/drivers/acpi/pmic/intel_pmic.c
> +++ b/drivers/acpi/pmic/intel_pmic.c
> @@ -252,7 +252,7 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  					struct regmap *regmap,
>  					struct intel_pmic_opregion_data *d)
>  {
> -	acpi_status status;
> +	acpi_status status = AE_OK;
>  	struct intel_pmic_opregion *opregion;
>  	int ret;
>  
> @@ -270,7 +270,8 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  	opregion->regmap = regmap;
>  	opregion->lpat_table = acpi_lpat_get_conversion_table(handle);
>  
> -	status = acpi_install_address_space_handler(handle,
> +	if (d->power_table_count)
> +		status = acpi_install_address_space_handler(handle,
>  						    PMIC_POWER_OPREGION_ID,
>  						    intel_pmic_power_handler,
>  						    NULL, opregion);
> @@ -279,7 +280,8 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  		goto out_error;
>  	}
>  
> -	status = acpi_install_address_space_handler(handle,
> +	if (d->thermal_table_count)
> +		status = acpi_install_address_space_handler(handle,
>  						    PMIC_THERMAL_OPREGION_ID,
>  						    intel_pmic_thermal_handler,
>  						    NULL, opregion);
> @@ -301,12 +303,16 @@ int intel_pmic_install_opregion_handler(struct device *dev, acpi_handle handle,
>  	return 0;
>  
>  out_remove_thermal_handler:
> -	acpi_remove_address_space_handler(handle, PMIC_THERMAL_OPREGION_ID,
> -					  intel_pmic_thermal_handler);
> +	if (d->thermal_table_count)
> +		acpi_remove_address_space_handler(handle,
> +						  PMIC_THERMAL_OPREGION_ID,
> +						  intel_pmic_thermal_handler);
>  
>  out_remove_power_handler:
> -	acpi_remove_address_space_handler(handle, PMIC_POWER_OPREGION_ID,
> -					  intel_pmic_power_handler);
> +	if (d->power_table_count)
> +		acpi_remove_address_space_handler(handle,
> +						  PMIC_POWER_OPREGION_ID,
> +						  intel_pmic_power_handler);
>  
>  out_error:
>  	acpi_lpat_free_conversion_table(opregion->lpat_table);
> -- 
> 2.23.0
> 

-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ