Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3fe444ad authored by Rafael J. Wysocki's avatar Rafael J. Wysocki
Browse files

ACPI: Do not fail acpi_bind_one() if device is already bound correctly



Modify acpi_bind_one() so that it doesn't fail if the device
represented by its first argument has already been bound to the
given ACPI handle (second argument), because that is not a good
enough reason for returning an error code.

Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Reviewed-by: default avatarLan Tianyu <tianyu.lan@intel.com>
Acked-by: default avatarToshi Kani <toshi.kani@hp.com>
parent 69fdadfd
Loading
Loading
Loading
Loading
+10 −3
Original line number Diff line number Diff line
@@ -217,7 +217,10 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
		/* Sanity check. */
		if (pn->dev == dev) {
			dev_warn(dev, "Already associated with ACPI node\n");
			goto err_free;
			if (ACPI_HANDLE(dev) == handle)
				retval = 0;

			goto out_free;
		}
		if (pn->node_id == node_id) {
			physnode_list = &pn->node;
@@ -255,10 +258,14 @@ int acpi_bind_one(struct device *dev, acpi_handle handle)
	put_device(dev);
	return retval;

 err_free:
 out_free:
	mutex_unlock(&acpi_dev->physical_node_lock);
	kfree(physical_node);
	if (retval)
		goto err;

	put_device(dev);
	return 0;
}
EXPORT_SYMBOL_GPL(acpi_bind_one);