Commit 48f76a12 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull ACPI support fixes from Rafael Wysocki:
 "These fix several platform drivers that use the ACPI companion of the
  given platform device without checking its presence, which may lead to
  a NULL pointer dereference or other kind of malfunction if the driver
  is forced to match a device without an ACPI companion via driver
  override, and restore debug log level for some messages in the ACPI
  CPPC library:

   - Check ACPI_COMPANION() against NULL during probe in several core
     ACPI device drivers (Rafael Wysocki)

   - Restore log level of messages in amd_set_max_freq_ratio() (Mario
     Limonciello)"

* tag 'acpi-7.1-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  ACPI: PAD: xen: Check ACPI_COMPANION() against NULL
  ACPI: driver: Check ACPI_COMPANION() against NULL during probe
  Revert "ACPI: CPPC: Adjust debug messages in amd_set_max_freq_ratio() to warn"
parents 66182ca8 af149b66
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -88,19 +88,19 @@ static void amd_set_max_freq_ratio(void)

	rc = cppc_get_perf_caps(0, &perf_caps);
	if (rc) {
		pr_warn("Could not retrieve perf counters (%d)\n", rc);
		pr_debug("Could not retrieve perf counters (%d)\n", rc);
		return;
	}

	rc = amd_get_boost_ratio_numerator(0, &numerator);
	if (rc) {
		pr_warn("Could not retrieve highest performance (%d)\n", rc);
		pr_debug("Could not retrieve highest performance (%d)\n", rc);
		return;
	}
	nominal_perf = perf_caps.nominal_perf;

	if (!nominal_perf) {
		pr_warn("Could not retrieve nominal performance\n");
		pr_debug("Could not retrieve nominal performance\n");
		return;
	}

+5 −1
Original line number Diff line number Diff line
@@ -192,11 +192,15 @@ static const struct dmi_system_id ac_dmi_table[] __initconst = {

static int acpi_ac_probe(struct platform_device *pdev)
{
	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
	struct power_supply_config psy_cfg = {};
	struct acpi_device *adev;
	struct acpi_ac *ac;
	int result;

	adev = ACPI_COMPANION(&pdev->dev);
	if (!adev)
		return -ENODEV;

	ac = kzalloc_obj(struct acpi_ac);
	if (!ac)
		return -ENOMEM;
+5 −1
Original line number Diff line number Diff line
@@ -423,7 +423,11 @@ static void acpi_pad_notify(acpi_handle handle, u32 event, void *data)

static int acpi_pad_probe(struct platform_device *pdev)
{
	struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
	struct acpi_device *adev;

	adev = ACPI_COMPANION(&pdev->dev);
	if (!adev)
		return -ENODEV;

	return acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
					       acpi_pad_notify, adev);
+5 −1
Original line number Diff line number Diff line
@@ -815,12 +815,16 @@ static void acpi_tad_remove(void *data)
static int acpi_tad_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	acpi_handle handle = ACPI_HANDLE(dev);
	struct acpi_tad_driver_data *dd;
	acpi_handle handle;
	acpi_status status;
	unsigned long long caps;
	int ret;

	handle = ACPI_HANDLE(dev);
	if (!handle)
		return -ENODEV;

	/*
	 * Initialization failure messages are mostly about firmware issues, so
	 * print them at the "info" level.
+5 −1
Original line number Diff line number Diff line
@@ -1214,10 +1214,14 @@ static void sysfs_battery_cleanup(struct acpi_battery *battery)

static int acpi_battery_probe(struct platform_device *pdev)
{
	struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
	struct acpi_battery *battery;
	struct acpi_device *device;
	int result;

	device = ACPI_COMPANION(&pdev->dev);
	if (!device)
		return -ENODEV;

	if (device->dep_unmet)
		return -EPROBE_DEFER;

Loading